diff --git a/home.admin/50torrentHDD.sh b/home.admin/50torrentHDD.sh index a9d9f13..02dfe07 100755 --- a/home.admin/50torrentHDD.sh +++ b/home.admin/50torrentHDD.sh @@ -40,7 +40,7 @@ targetDir="/mnt/hdd/torrent" sessionDir="/home/admin/.rtorrent.session" # BACKUP TORRENT SEEDING -if [ "$1" == "cleanup" ]; then +if [ "$1" == "stop" ] || [ "$1" == "cleanup" ]; then echo "Stopping Torrents ..." sessionPID=$(screen -ls | grep "blockchain" | cut -d "." -f1 | xargs) if [ ${#sessionPID} -gt 0 ]; then @@ -50,6 +50,20 @@ if [ "$1" == "cleanup" ]; then if [ ${#sessionPID} -gt 0 ]; then sudo pkill -P ${sessionPID} fi +fi +if [ "$1" == "stop" ] || [ "$1" == "cleanup" ]; then + echo "Stopping Torrents ..." + sessionPID=$(screen -ls | grep "blockchain" | cut -d "." -f1 | xargs) + if [ ${#sessionPID} -gt 0 ]; then + sudo pkill -P ${sessionPID} + fi + sessionPID=$(screen -ls | grep "update" | cut -d "." -f1 | xargs) + if [ ${#sessionPID} -gt 0 ]; then + sudo pkill -P ${sessionPID} + fi + if [ "$1" == "stop" ]; then + exit 0 + fi echo "Deleting all possible old (version) torrent data ..." sudo rm -r /home/admin/.rtorrent.session 2>/dev/null sudo rm -r /mnt/hdd/torrent 2>/dev/null