diff options
| author | Horus3 | 2014-12-10 20:44:48 +0100 |
|---|---|---|
| committer | Horus3 | 2014-12-10 20:44:48 +0100 |
| commit | 510493a04ccf84b301a271b56687ecf729b2c61a (patch) | |
| tree | 44d180d8f1bda62152cd02cabbcafaa583193bd6 | |
| parent | afdd4806fcd15a02cd4caa74c252dc9db8455a21 (diff) | |
| download | dotfiles-510493a04ccf84b301a271b56687ecf729b2c61a.tar.gz | |
Added init script for rtorrent with screen support
| -rwxr-xr-x | rtorrent/init.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/rtorrent/init.sh b/rtorrent/init.sh new file mode 100755 index 0000000..7f36a74 --- /dev/null +++ b/rtorrent/init.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +RTORRENTUSER="horus" +NAME=rtorrent +DESC="rtorrent, a cli bittorrent client." + +DAEMON="/usr/bin/rtorrent" +SCREEN="/usr/bin/screen" + +PIDFILE="/var/run/${NAME}.pid" + +START_OPTS="--start --background --make-pidfile --pidfile ${PIDFILE} --chuid $RTORRENTUSER --exec $SCREEN -- -DmUS ${NAME} ${DAEMON}" +END_OPTS="--stop --pidfile ${PIDFILE}" + +case "$1" in + start) + echo "Starting ${DESC}" + start-stop-daemon $START_OPTS + ;; + stop) + echo "Stopping ${DESC}" + start-stop-daemon $END_OPTS + rm -f "${PIDFILE}" + ;; + restart) + "$0" stop + rm -f "${PIDFILE}" + sleep 1 + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac |
