Create restart_rtorrent.sh
This commit is contained in:
parent
239035d8a2
commit
06e90c55b9
27
SHELL/SEEDBOX/restart_rtorrent.sh
Normal file
27
SHELL/SEEDBOX/restart_rtorrent.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
while getopts ":a:" opt; do
|
||||
case "${opt}" in
|
||||
a) user="${OPTARG}";;
|
||||
esac
|
||||
done
|
||||
|
||||
# A MODIFIER AVEC LES USERS SOUHAITES
|
||||
# users=(stan thomas guenot denis)
|
||||
|
||||
# A ADAPTER AU BESOIN
|
||||
file=/home/$user/.session/rtorrent.lock
|
||||
|
||||
# EXTRACTION DU PID DE RTORRENT DU USER
|
||||
pid=$(ps -u $user -o pid,command | grep '[0-9] rtorrent$' | cut -d "r" -f1)
|
||||
|
||||
# SI RTORRENT EST ACTIF LE PID NE SERA PAS VIDE
|
||||
if [ ! $pid ];then
|
||||
# ON SUPPRIME rtorrent.lock CAR CA EMPECHE RTORRENT DE DEMARRER
|
||||
rm -f $file
|
||||
# RESTART RTORRENT USER
|
||||
bash /etc/init.d/$user-rtorrent restart
|
||||
# LOG
|
||||
echo "$(date) : le rtorrent de $user a ete redemarre" >> /var/log/rtorrent-check.log
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user