Initial Commit
[Projects.git] / pkgbuilds / pytivo / rc.d
blob1cd8a31a8fd14800f211b0ea99a3510412605cd1
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 NAME=pytivo
7 FILE=/usr/share/pyTivo/pyTivo.py
8 PID=`pgrep -f pyTivo.py`
9 DESCRIPTION=pyTivo
11 case "$1" in
12 start)
13 stat_busy "Starting $DESCRIPTION..."
14 [ -z "$PID" ] && python $FILE > /dev/null 2>&1 &
15 if [ $? -gt 0 ]; then
16 stat_fail
17 else
18 add_daemon $NAME
19 stat_done
22 stop)
23 stat_busy "Stopping $DESCRIPTION..."
24 [ ! -z "$PID" ] && kill -9 $PID &>/dev/null
25 if [ $? -gt 0 ]; then
26 stat_fail
27 else
28 rm_daemon $NAME
29 stat_done
32 restart|force-reload)
33 $0 stop
34 $0 start
36 esac
37 exit 0