PKGBUILDs/community/pyrss/pyrss.rc

54 lines
977 B
Text
Raw Normal View History

2009-10-10 02:15:33 +00:00
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
get_pid() {
echo `ps fax|egrep "python ./start.py|python pyrss.py" | awk -- "{print \\\$1}"`
}
case "$1" in
start)
stat_busy "Starting jabber RSS transport daemon"
[ -f /var/run/pyrss.pid ] && rm -f /var/run/pyrss.pid
PID=`get_pid`
if [ -z "$PID" ]; then
cd /usr/lib/pyrss && python ./start.py 1>/dev/null 2>/dev/null &
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
add_daemon pyrss
stat_done
fi
else
stat_fail
exit 1
fi
;;
stop)
stat_busy "Stopping jabber RSS transport daemon"
PID=`get_pid`
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
rm -f /var/run/pyrss.pid &> /dev/null
rm_daemon pyrss
stat_done
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0