updated on Tue Jan 17 20:03:13 UTC 2012
[aur-mirror.git] / j2j / j2j.rc
blobf5cdf6d55b68d5630f6c50d500c3db5a4c04868a
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 get_pid() {
7 [ -f /var/run/j2j.pid ] && echo `cat /var/run/j2j.pid`
10 case "$1" in
11 start)
12 stat_busy "Starting j2j transport daemon"
14 [ -f /var/run/j2j.pid ] && rm -f /var/run/j2j.pid
15 PID=`get_pid`
16 if [ -z "$PID" ]; then
17 cd /usr/share/j2j && python ./main.py 1>/dev/null 2>/dev/null &
18 if [ $? -gt 0 ]; then
19 stat_fail
20 exit 1
21 else
22 add_daemon j2j
23 stat_done
25 else
26 stat_fail
27 exit 1
31 stop)
32 stat_busy "Stopping j2j transport daemon"
33 PID=`get_pid`
34 [ ! -z "$PID" ] && kill $PID &> /dev/null
35 if [ $? -gt 0 ]; then
36 stat_fail
37 exit 1
38 else
39 rm -f /var/run/j2j.pid &> /dev/null
40 rm_daemon j2j
41 stat_done
45 restart)
46 $0 stop
47 sleep 3
48 $0 start
51 echo "usage: $0 {start|stop|restart}"
52 esac
53 exit 0