updated on Wed Jan 18 20:10:41 UTC 2012
[aur-mirror.git] / headphones-git / headphones.init
blob92ac459df60cc9ff89a388a390df2b68c2b1f36c
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/headphones
7 case "$1" in
8 start)
9 stat_busy "Starting Headphones"
11 if [ -f $HP_PIDFILE ]; then
12 stat_fail
13 PID=`cat $HP_PIDFILE`
14 echo "Headphones is already running: $PID"
15 else
16 su - $HP_USER -c "$HP_PYTHON $HP_BIN -q -d --config $HP_CONF --port $HP_PORT --pidfile $HP_PIDFILE" -s /bin/sh
17 if [ $? -gt 0 ]; then
18 stat_fail
19 else
20 touch $HP_PIDFILE
21 stat_done
25 stop)
26 stat_busy "Stopping Headphones"
28 if [ -f $HP_PIDFILE ]; then
29 PID=`cat $HP_PIDFILE`
30 kill -TERM $PID
31 rm $HP_PIDFILE
32 stat_done
33 else
34 stat_fail
37 restart)
38 $0 stop
39 sleep 1
40 $0 start
43 echo "usage: $0 {start|stop|restart}"
44 esac
45 exit 0