]>
Commit | Line | Data |
---|---|---|
d4702dae | 1 | #!/bin/sh |
2 | # | |
3 | # Startup script for the DNS caching server | |
4 | # | |
5 | # chkconfig: 2345 81 45 | |
6 | # description: Anubis is an outgoing mail processor, and the SMTP tunnel. | |
7 | # processname: anubis | |
8 | # config: /etc/anubisrc | |
9 | ||
10 | # Set some frequently user variables | |
11 | SERVICE=anubis | |
12 | LOCKFILE=/var/lock/subsys/$SERVICE | |
e56aeec7 | 13 | MSG=$SERVICE |
d4702dae | 14 | PROG=$SERVICE |
15 | ||
16 | # Source funtion library | |
17 | . /etc/rc.d/init.d/functions | |
18 | ||
19 | # Get network config | |
20 | . /etc/sysconfig/network | |
21 | ||
22 | # Check that networking is up | |
e8be5dc3 | 23 | if is_yes "${NETWORKING}"; then |
542bbb6e | 24 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
e8be5dc3 | 25 | msg_network_down $MSG |
26 | exit 1 | |
27 | fi | |
28 | else | |
29 | exit 0 | |
d4702dae | 30 | fi |
31 | ||
32 | # Get service config | |
33 | [ -f "/etc/sysconfig/$SERVICE" ] && . "/etc/sysconfig/$SERVICE" | |
34 | ||
a58bff5d | 35 | start() { |
d4702dae | 36 | if [ ! -f "$LOCKFILE" ]; then |
37 | msg_starting "$MSG" | |
e8be5dc3 | 38 | daemon $PROG |
d4702dae | 39 | RETVAL=$? |
e8be5dc3 | 40 | [ $RETVAL -eq 0 ] && touch $LOCKFILE |
d4702dae | 41 | else |
1c727793 | 42 | msg_already_running $MSG |
d4702dae | 43 | fi |
a58bff5d JB |
44 | } |
45 | ||
46 | stop() { | |
d4702dae | 47 | if [ -f "$LOCKFILE" ]; then |
48 | msg_stopping "$MSG" | |
e8be5dc3 | 49 | killproc $PROG |
d4702dae | 50 | rm -f $LOCKFILE >/dev/null 2>&1 |
51 | else | |
1c727793 | 52 | msg_not_running "$MSG" |
e8be5dc3 | 53 | fi |
a58bff5d JB |
54 | } |
55 | ||
56 | condrestart() { | |
57 | if [ -f "$LOCKFILE" ]; then | |
58 | stop | |
59 | start | |
60 | else | |
61 | msg_not_running "$MSG" | |
62 | RETVAL=$1 | |
63 | fi | |
64 | } | |
65 | ||
66 | RETVAL=0 | |
67 | # See how we were called. | |
68 | case "$1" in | |
69 | start) | |
70 | start | |
71 | ;; | |
72 | stop) | |
73 | stop | |
74 | ;; | |
75 | restart) | |
76 | stop | |
77 | start | |
78 | ;; | |
79 | try-restart) | |
80 | condrestart 0 | |
81 | ;; | |
82 | force-reload) | |
83 | condrestart 7 | |
e8be5dc3 | 84 | ;; |
d4702dae | 85 | status) |
86 | status $PROG | |
87 | exit $? | |
88 | ;; | |
d4702dae | 89 | *) |
2a40d39c | 90 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
91 | exit 3 | |
d4702dae | 92 | esac |
93 | ||
94 | exit $RETVAL |