Skip to content

Instantly share code, notes, and snippets.

@Magicalex
Last active March 28, 2020 23:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Magicalex/8850ac8539d89af2f21f to your computer and use it in GitHub Desktop.
Save Magicalex/8850ac8539d89af2f21f to your computer and use it in GitHub Desktop.
script init.d/rtorrent
#!/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
@Machou
Copy link

Machou commented Oct 11, 2015

Mettre en français les phrases non ? :D

@PixiBixi
Copy link

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