blob: 7f36a741f6e16b70c14c6f81a7f46e26918819d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
|