You are on page 1of 1

#!

/bin/bash
# Rename to shutdownIfFile.sh and make executable
# Transmission: Call this script when Torrent is completed
# Written for transmission-gtk for an OS using systemd
# Dependency: uses zenity and notify-send
file="/tmp/shutdownActive"
if [ -e $file ]; then
echo "File exists"
preg=$(/usr/bin/zenity --timeout=20 --question --text="Shutdown? (20 sec
onds)")
if [ $? -eq 1 ] ; then
notify-send "Shutdown Aborted!"
echo "Shutdown Aborted!"
else
notify-send "Closing Transmission and SHUTTING DOWN PC..."
echo "Closing Transmission and SHUTTING DOWN PC..."
# shutdown -h now
killall -w -q transmission-gtk; systemctl poweroff
fi
else
echo "File does not exists"
fi

You might also like