This commit is contained in:
Andrea Cotza
2015-08-10 22:57:41 +02:00
commit 4a049d3241
12 changed files with 1815 additions and 0 deletions

36
sources/init/rtorrent Normal file
View File

@@ -0,0 +1,36 @@
#!/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="rtorrent"
## Fin configuration ##
rt_start() {
su --command="screen -dmS rtorrent rtorrent" "${user}"
}
rt_stop() {
killall --user "${user}" screen
}
case "$1" in
start) echo "Starting rtorrent..."; rt_start
;;
stop) echo "Stopping rtorrent..."; rt_stop
;;
restart) echo "Restart rtorrent..."; rt_stop; sleep 1; rt_start
;;
*) echo "Usage: $0 {start|stop|restart}"; exit 1
;;
esac
exit 0