updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / subsonic-beta / subsonic.rc
blob7a06e96fd13a1fb81f4d9ee1d2f248d78cdbf2fb
1 #!/bin/bash
3 PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/java/jre/bin
4 DESC="subsonic server"
5 NAME=subsonic
6 PIDFILE=/var/run/$NAME.pid
7 DAEMON=/var/subsonic/subsonic.sh
8 DAEMON_ARGS="--pidfile=$PIDFILE"
10 . /etc/rc.conf
11 . /etc/rc.d/functions
13 PID=$(ps ax |grep java |grep subsonic |awk '{ print $1 }')
14 case "$1" in
15 start)
16 if [ ! -z "$PID" ]; then
17 stat_fail
18 else
19 stat_busy "Starting $NAME..."
20 $DAEMON $DAEMON_ARGS &>/dev/null
21 if [ $? -gt 0 ]; then
22 stat_fail
23 else
24 add_daemon $NAME
25 sleep 2
26 stat_done
30 stop)
31 stat_busy "Stopping $NAME..."
32 if [ -a $PIDFILE ]; then
33 PID=`cat $PIDFILE`
34 kill $PID > /dev/null
35 if [ $? -gt 0 ]; then
36 stat_fail
37 else
38 rm $PIDFILE
39 rm_daemon $NAME
40 stat_done
42 else
43 [ ! -z "$PID" ] && kill $PID &> /dev/null
44 if [ $? -gt 0 ]; then
45 stat_fail
46 else
47 stat_done
51 restart|force-reload)
52 $0 stop
53 sleep 1
54 $0 start
56 esac
57 exit 0