]>
Commit | Line | Data |
---|---|---|
ae49a027 | 1 | #!/bin/bash |
2 | # | |
3 | # whosond Start/Stop whosond server | |
4 | # | |
5 | # chkconfig: 345 40 65 | |
6 | # description: whosond - implementation of WHOSON protocol | |
7 | # | |
b4b454ae | 8 | # processname: whosond |
9 | # config: /etc/whoson.conf | |
ae49a027 | 10 | |
b4b454ae | 11 | # Source function library |
ae49a027 | 12 | . /etc/rc.d/init.d/functions |
13 | ||
b4b454ae | 14 | # Get network config |
ae49a027 | 15 | . /etc/sysconfig/network |
16 | ||
b4b454ae | 17 | # Get service config |
18 | [ -f /etc/sysconfig/whoson ] && . /etc/sysconfig/whoson | |
19 | ||
ae49a027 | 20 | # Check that networking is up. |
b4b454ae | 21 | if [ "${NETWORKING}" = "no" ]; then |
e6b574e4 | 22 | echo "WARNING: Networking is down. Whoson service can't be run." |
b4b454ae | 23 | exit 1 |
ae49a027 | 24 | fi |
25 | ||
ae49a027 | 26 | # See how we were called. |
27 | case "$1" in | |
28 | start) | |
b4b454ae | 29 | # Check if the service is already running? |
30 | if [ ! -f /var/lock/subsys/whoson ]; then | |
a1e5130d | 31 | msg_starting "whosond" |
b4b454ae | 32 | daemon whosond |
a1e5130d | 33 | RETVAL=$? |
34 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/whoson | |
b4b454ae | 35 | else |
a1e5130d | 36 | msg_Already_Running whoson |
37 | exit 1 | |
b4b454ae | 38 | fi |
a1e5130d | 39 | ;; |
ae49a027 | 40 | stop) |
a1e5130d | 41 | # Stop daemons. |
42 | if [ -f /var/lock/subsys/syslogd ]; then | |
43 | msg_stopping whoson | |
44 | killproc whosond | |
45 | rm -f /var/lock/subsys/whoson >/dev/null 2>&1 | |
46 | else | |
47 | msg_Not_Running whoson | |
48 | exit 1 | |
49 | fi | |
50 | ;; | |
51 | restart) | |
52 | $0 stop | |
53 | $0 start | |
54 | ;; | |
55 | reload) | |
56 | if [ -f /var/lock/subsys/whoson ]; then | |
57 | msg_show whoson | |
58 | msg_reload | |
59 | busy | |
60 | killproc whosond -HUP | |
61 | deltext | |
62 | ok | |
63 | else | |
64 | msg_Not_Running whoson | |
65 | exit 1 | |
66 | fi | |
67 | ;; | |
68 | force-reload) | |
69 | $0 stop && $0 start | |
70 | exit $? | |
ae49a027 | 71 | ;; |
72 | status) | |
73 | status whosond | |
a1e5130d | 74 | exit $? |
75 | ;; | |
ae49a027 | 76 | *) |
a1e5130d | 77 | # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0 |
78 | msg_Usage "$0 {start|stop|status|restart|reload|force-reload}" | |
79 | exit 1 | |
ae49a027 | 80 | esac |
81 | ||
a1e5130d | 82 | exit $RETVAL |