torrent add stop

This commit is contained in:
Christian Rotzoll
2019-04-15 02:25:24 +01:00
parent fbec65fac1
commit 0d969cbb68

View File

@@ -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