Transmission shutdown script for multiple torrents?
Posted
by
Khurshid Alam
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Khurshid Alam
Published on 2012-10-18T16:28:14Z
Indexed on
2012/10/18
17:25 UTC
Read the original article
Hit count: 288
I have written a shutdown script for transmission. Transmission calls the script after a torrent download finishes. The script runs perfectly on my machine (Ubuntu 11.04 & 12.04).
#!/bin/bash
sleep 300s
# default display on current host
DISPLAY=:0.0
# find out if monitor is on. Default timeout can be configured from screensaver/Power configuration.
STATUS=`xset -display $DISPLAY -q | grep 'Monitor'`
echo $STATUS
if [ "$STATUS" == " Monitor is On" ]
### Then check if its still downloading a torrent. Couldn't figure out how.(May be) by monitoring network downstream activity?
then
notify-send "Downloads Complete" "Exiting transmisssion now"
pkill transmission
else
notify-send "Downloads Complete" "Shutting Down Computer"
dbus-send --session --type=method_call --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.RequestShutdown
fi
exit 0
The problem is that when I'm downloading more than one file, when the first one finishes, transmission executes the script. I would like to do that but after all downloads are completed.
I want to put a 2nd check ( right after monitor check) if it is still downloading another torrent.
Is there any way to do this?
© Ask Ubuntu or respective owner