]>
Commit | Line | Data |
---|---|---|
111cef57 | 1 | #!/bin/bash |
2 | # | |
3 | # mathopd Tiny/turbo http daemon | |
4 | # | |
39c283f5 | 5 | # chkconfig: 2345 95 01 |
111cef57 | 6 | # description: mathopd |
7 | # processname: mathopd | |
8 | # pidfile: /var/run/mathopd.pid | |
9 | # config: /etc/mathopd.conf | |
10 | ||
11 | # Source function library | |
12 | . /etc/rc.d/init.d/functions | |
13 | ||
14 | # Get network config | |
15 | . /etc/sysconfig/network | |
16 | ||
8d1e9c35 | 17 | # Check that networking is up. |
18 | if is_yes "${NETWORKING}"; then | |
0e9db894 | 19 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
8d1e9c35 | 20 | msg_network_down mathopd |
21 | exit 1 | |
22 | fi | |
23 | else | |
24 | exit 0 | |
25 | fi | |
26 | ||
111cef57 | 27 | # Get service config |
28 | [ -f /etc/sysconfig/mathopd ] && . /etc/sysconfig/mathopd | |
29 | ||
f81250c8 | 30 | RETVAL=0 |
111cef57 | 31 | # See how we were called. |
32 | case "$1" in | |
33 | start) | |
8d1e9c35 | 34 | # Check if the service is already running? |
111cef57 | 35 | if [ ! -f /var/lock/subsys/mathopd ]; then |
36 | msg_starting mathopd | |
37 | touch /var/run/mathopd.pid | |
38 | chown http.http /var/run/mathopd.pid | |
39 | daemon /usr/sbin/mathopd -f /etc/mathopd.conf | |
40 | RETVAL=$? | |
41 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mathopd | |
42 | else | |
8d1e9c35 | 43 | msg_already_running mathopd |
111cef57 | 44 | fi |
45 | ;; | |
46 | stop) | |
8d1e9c35 | 47 | # Stop daemons. |
111cef57 | 48 | if [ -f /var/lock/subsys/mathopd ]; then |
49 | msg_stopping mathopd | |
50 | killproc mathopd | |
51 | rm -f /var/lock/subsys/mathopd /var/run/mathopd.pid /var/run/mathopd.loc* >/dev/null 2>&1 | |
52 | else | |
8d1e9c35 | 53 | msg_not_running mathopd |
111cef57 | 54 | fi |
55 | ;; | |
56 | status) | |
8d1e9c35 | 57 | status mathopd |
111cef57 | 58 | exit $? |
59 | ;; | |
f81250c8 | 60 | restart|force-reload) |
8d1e9c35 | 61 | $0 stop |
111cef57 | 62 | $0 start |
f81250c8 | 63 | exit $? |
111cef57 | 64 | ;; |
8d1e9c35 | 65 | *) |
f81250c8 | 66 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
67 | exit 3 | |
111cef57 | 68 | esac |
69 | ||
8d1e9c35 | 70 | exit $RETVAL |