on second thought, remove arch restrictions and explicitly depend on golang-go
[debian/orchestra.git] / debian / orchestra-player-go.init
1 #!/bin/sh
2
3 ### BEGIN INIT INFO
4 # Provides:             orchestra-player-go
5 # Required-Start:       networking
6 # Required-Stop:        networking
7 # Default-Start:        2 3 4 5
8 # Default-Stop:         0 1 6
9 # Short-Description:    Player execuation agent for Orchestra
10 ### END INIT INFO
11
12 set -e
13
14 export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
15
16 PLAYER=/usr/sbin/player
17
18 test -x "${PLAYER}" || exit 0
19
20 PLAYER_ARGS=""
21 ENABLED=no
22
23 PIDFILE=/var/run/orchestra-player-go.pid
24
25 if test -f /etc/default/orchestra-player-go; then
26    . /etc/default/orchestra-player-go
27 fi
28
29 . /lib/lsb/init-functions
30
31 if [ "${ENABLED}" != "yes" ]; then
32     exit 0
33 fi
34
35 case "$1" in
36     start)
37         log_daemon_msg "Starting the Player"
38         if start-stop-daemon --start --quiet --oknodo --background --pidfile "${PIDFILE}" --make-pidfile --exec "${PLAYER}" -- ${PLAYER_ARGS}; then
39             log_end_msg 0
40         else
41             log_end_msg 1
42         fi
43         ;;
44     stop)
45         log_daemon_msg "Stopping the Player"
46         if start-stop-daemon --stop --quiet --oknodo --pidfile "${PIDFILE}" -x "${PLAYER}"; then
47             log_end_msg 0
48         else
49             log_end_msg 1
50         fi
51         ;; 
52     reload)
53         log_daemon_msg "Asking the Player to Reload Configuration"
54         if start-stop-daemon --stop --quiet --signal HUP --pidfile "${PIDFILE}" -x "${PLAYER}"; then
55             log_end_msg 0
56         else
57             log_end_msg 1
58         fi
59         ;;
60     status)
61         status_of_proc -p "${PIDFILE}" "${PLAYER}" player && exit 0 || exit $?
62         ;;
63     *)
64         log_action_msg "Usage: /etc/init.d/orchestra-player-go {start|stop|status}"
65         exit 1
66         ;;
67 esac