Last active
March 28, 2020 23:49
-
-
Save Magicalex/8850ac8539d89af2f21f to your computer and use it in GitHub Desktop.
script init.d/rtorrent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Dépendance : screen, killall et rtorrent | |
### BEGIN INIT INFO | |
# Provides: <username>-rtorrent | |
# Required-Start: $syslog $network | |
# Required-Stop: $syslog $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time | |
# Description: Start-Stop rtorrent user session | |
### END INIT INFO | |
## Début configuration ## | |
user="<username>" | |
## Fin configuration ## | |
rt_start() { | |
su --command="screen -dmS ${user}-rtorrent rtorrent" "${user}" | |
} | |
rt_stop() { | |
su --command="screen -S ${user}-rtorrent -X quit" "${user}" | |
} | |
case "$1" in | |
start) | |
echo "Démarrage de rtorrent..." | |
rt_start | |
;; | |
stop) | |
echo "Arrêt de rtorrent..." | |
rt_stop | |
;; | |
restart) | |
echo "Redémarrage de rtorrent..." | |
rt_stop | |
sleep 1 | |
rt_start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Comme dit le gars, pourquoi ne pas mettre les phrases en FR, ainsi que d'indenter le case ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mettre en français les phrases non ? :D