English 中文(简体)
传送不会在超常下载完成后操作剪辑。
原标题:Transmission will not run shell script after torrent download completed

我期待发送的仲裁员客户执行一个文字,改变所有犯法者的所有权和许可权,如果傲慢地完成下载的话。

我正在使用以下相关环境: json:

"download-dir": "/data/transmission/completed",
"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/home/user/script.sh",

我知道,有些问题可以在文字内容之外处理。 文字档案的所有人是非布道,我已获准进入777份,因此,除非我在这里错过一些东西,否则就会出现发送文件的问题。

The /home/user/script.sh file is as follows:

#!/bin/bash
echo sudopassword | /usr/bin/sudo -S /bin/chmod -f -R 777 /data/transmission/completed
echo sudopassword | /usr/bin/sudo -S /bin/chown -f -R user /data/transmission/completed

I know it is poor form to use a sudo command in this fashion, but I can execute the script on it s own and it will work correctly. I am not sure why Transmission is not executing the script. Transmission supports some environment variables such as TR_TORRENT_NAME that I would like to use once the script is being triggered. Is there anything I am not setting up in the file that would prevent the script from working correctly and how would I use environment variables?

问题回答

我或许会在这里回答一个不同的问题,但如果你再次试图这样做,就是为了在你向用户下载Daemon时获得书面许可,就会尝试另一种做法。

I m running my Transmission Daemon under my username, as set in it s systemd service file. (/etc/systemd/system/multi-user.target.wants/transmission-daemon.service in my case)

[Unit]
Description=Transmission BitTorrent Daemon
After=network.target

[Service]
User=myuser      # set user here
Group=mygroup    # set group here :) 
UMask=0022       # 0022 gives 644 permissions on files (u+w), 0002 gives 644 (g+w), 0000 gives 666 (a+w)
Type=notify
ExecStart=/usr/bin/transmission-daemon -f --log-error
ExecStop=/bin/kill -s STOP $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID

[Install]
WantedBy=multi-user.target

Notice User, Group and UMask (with capital M) directives. See Execution environment configuration for Systemd manpage.

Then run:

sudo chown -fR user /data/transmission/completed
sudo systemctl daemon-reload
sudo service transmission-daemon restart

并且应当:

Add the user who will execute the script to a group with default sudo access.


Fedora - add user to the wheel group

sudo usermod -aG wheel $(whoami)

Ubuntu - user group: sudo or admin (deprecated)





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Bash usage of vi or emacs

From a programming standpoint, when you set the bash shell to use vi or emacs via set -o vi or set -o emacs What is actually going on here? I ve been reading a book where it claims the bash shell ...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Perform OR on two hash outputs of sha1sum

I want perform sha1sum file1 and sha1sum file2 and perform bitwise OR operation with them using bash. Output should be printable i.e 53a23bc2e24d039 ... (160 bit) How can I do this? I know echo $(( ...

Set screen-title from shellscript

Is it possible to set the Screen Title using a shell script? I thought about something like sending the key commands ctrl+A shift-A Name enter I searched for about an hour on how to emulate ...

热门标签