every rtorrent process cpulimit

This commit is contained in:
Christian Rotzoll
2019-04-14 23:02:36 +01:00
parent 20be83076a
commit 6a9b40f9f3

View File

@@ -162,14 +162,26 @@ if [ "$1" == "backup-torrent-hosting" ]; then
sudo sed -i "s/^backupTorrentSeeding=.*/backupTorrentSeeding=on/g" /mnt/hdd/raspiblitz.conf
fi
# set the torrents processes to cpulimit 20%
sessionPID=$(screen -ls | grep "blockchain" | cut -d "." -f1 | xargs)
echo "Putting rTorrent blockchain 'BASE' (PID=${sessionPID}) to background ... (please wait)"
sudo cpulimit -p ${sessionPID} -l 25 &
sessionPID=$(screen -ls | grep "update" | cut -d "." -f1 | xargs)
echo "Putting rTorrent blockchain 'UPDATE' (PID=${sessionPID}) to background ... (please wait)"
sudo cpulimit -p ${sessionPID} -l 25 &
# set the torrents processes to cpulimit 25%
sleep 6
echo ""
rtorrentPIDs=$(ps axf | grep "rtorrent" | awk '{$1=$1;print}' | cut -d' ' -f1)
while read -r pid ; do
ps ${pid} | grep "rtorrent"
echo "---> reducing this rTorrent process to 25% CPU"
sudo cpulimit -p ${pid} -l 25 &
echo ""
done < <(echo "${rtorrentPIDs}")
sleep 6
# set the torrents processes to cpulimit 20%
#sessionPID=$(screen -ls | grep "blockchain" | cut -d "." -f1 | xargs)
#echo "Putting rTorrent blockchain 'BASE' (PID=${sessionPID}) to background ... (please wait)"
#sudo cpulimit -p ${sessionPID} -l 25 &
#sessionPID=$(screen -ls | grep "update" | cut -d "." -f1 | xargs)
#echo "Putting rTorrent blockchain 'UPDATE' (PID=${sessionPID}) to background ... (please wait)"
#sudo cpulimit -p ${sessionPID} -l 25 &
echo "Done BACKUP TORRENT HOSTING"
exit
fi