Update restart_rtorrent.sh
This commit is contained in:
parent
06e90c55b9
commit
aab44e79d4
@ -1,27 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
while getopts ":a:" opt; do
|
||||
while getopts ":u:" opt; do
|
||||
case "${opt}" in
|
||||
a) user="${OPTARG}";;
|
||||
u) 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
|
||||
kill -9 $pid
|
||||
/root/rtorrent-check
|
Loading…
Reference in New Issue
Block a user