updated on Fri Jan 13 08:00:32 UTC 2012
[aur-mirror.git] / jdchub / jdchub.d
blobdd32c37a469c9033648738244333e17e93454373
1 #!/bin/bash
3 daemon_name=jdchub
5 . /etc/rc.conf
6 . /etc/rc.d/functions
7 . /etc/conf.d/$daemon_name.conf
9 get_pid() {
10 pidof -o %PPID $daemon_name
13 case "$1" in
14 start)
15 stat_busy "Starting $daemon_name daemon"
17 PID=$(get_pid)
18 if [[ -z $PID ]]; then
19 [[ -f /var/run/$daemon_name.pid ]] &&
20 rm -f /var/run/$daemon_name.pid
21 # RUN
22 sh /opt/$daemon_name/jdchub-daemon.sh start
24 if [[ $? -gt 0 ]]; then
25 stat_fail
26 exit 1
27 else
28 echo $(get_pid) > /var/run/$daemon_name.pid
29 add_daemon $daemon_name
30 stat_done
32 else
33 stat_fail
34 exit 1
38 stop)
39 stat_busy "Stopping $daemon_name daemon"
40 PID=$(get_pid)
41 # KILL
42 sh /opt/$daemon_name/jdchub-daemon.sh stop &> /dev/null
44 if [[ $? -gt 0 ]]; then
45 stat_fail
46 exit 1
47 else
48 rm -f /var/run/$daemon_name.pid &> /dev/null
49 rm_daemon $daemon_name
50 stat_done
54 restart)
55 $0 stop
56 sleep 3
57 $0 start
60 status)
61 stat_busy "Checking $daemon_name status";
62 ck_status $daemon_name
66 echo "usage: $0 {start|stop|restart|status}"
67 esac
69 exit 0
71 # vim:set ts=2 sw=2 et: