Code: Select all
--torrent-done-script
I'm using a bash script, and calling
Code: Select all
exec >> logfile
It is supposed to add the oldest of the .torrent files in a queue directory.
However, when it runs, I just get output like this:
Code: Select all
[02:53:33.549] transmission-remote: (http://localhost:1234/transmission/rpc) Timeout was reached
When I run the script manually, even immediately after a failed launching of the script by transmission-daemon, it works consistently without problems.
The script is not using the transmission environment variables at all.
Here's my script:
Code: Select all
#!/bin/bash
TORRENT_DIR=~/Downloads/torrents/%queue;
ADDED_DIR="$TORRENT_DIR/%added";
TRANSMISSION_REMOTE=/usr/bin/transmission-remote;
LOG_FILE=~/var/log/transmission-daemon/add-least-recent.log;
exec >> "$LOG_FILE" 2>&1;
echo;
echo "{{{ $(date --rfc-3339=s | tr \ T) add-least-recent called.";
# Echoes the number of the last torrent added.
function last_added {
$TRANSMISSION_REMOTE 1234 -l | tail -2 | head -1 | sed 's/^\s*\([0-9]\+\).*/\1/';
}
oldest="$(ls -tr "$TORRENT_DIR"/*.torrent | head -1)" && \
$TRANSMISSION_REMOTE 1234 -a "$oldest" && \
mv "$oldest" "$ADDED_DIR" && \
$TRANSMISSION_REMOTE 1234 -t"$(last_added)" -s -Bn -pr20;
echo '}}}';