updated on Sun Jan 15 16:02:00 UTC 2012
[aur-mirror.git] / mopidy-git / mopidy.rc
blobbbb9dd1cc678980c9f6121601ffc75a5570027ee
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/mopidy
7 PID=`ps -A -F | grep -v grep | grep "/usr/bin/python2 /usr/bin/mopidy" | awk '{print $2}'`
9 case "$1" in
10 start)
11 stat_busy "Starting Mopidy"
12 if [ -z "$MOPIDY_USER" ]; then
13 stat_busy "No MOPIDY_USER, please edit /etc/conf.d/mopidy"
14 stat_fail
15 else
16 [ -z "$PID" ] && su -l -s /bin/sh -c "/usr/bin/mopidy &> /dev/null &" "$MOPIDY_USER"
17 if [ $? -gt 0 ]; then
18 stat_fail
19 else
20 add_daemon mopidy
21 stat_done
25 stop)
26 stat_busy "Stopping Mopidy"
27 [ ! -z "$PID" ] && kill $PID &> /dev/null
28 if [ $? -gt 0 ]; then
29 stat_fail
30 else
31 rm_daemon mopidy
32 stat_done
35 restart)
36 $0 stop
37 while [ ! -z "$PID" -a -d "/proc/$PID" ]; do sleep 1; done
38 $0 start
41 echo "usage: $0 {start|stop|restart}"
42 esac
43 exit 0