]>
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 | ||
2a40d39c | 35 | RETVAL=0 |
d4702dae | 36 | # See how we were called. |
37 | case "$1" in | |
38 | start) | |
39 | if [ ! -f "$LOCKFILE" ]; then | |
40 | msg_starting "$MSG" | |
e8be5dc3 | 41 | daemon $PROG |
d4702dae | 42 | RETVAL=$? |
e8be5dc3 | 43 | [ $RETVAL -eq 0 ] && touch $LOCKFILE |
d4702dae | 44 | else |
1c727793 | 45 | msg_already_running $MSG |
d4702dae | 46 | fi |
e8be5dc3 | 47 | ;; |
d4702dae | 48 | stop) |
49 | if [ -f "$LOCKFILE" ]; then | |
50 | msg_stopping "$MSG" | |
e8be5dc3 | 51 | killproc $PROG |
d4702dae | 52 | rm -f $LOCKFILE >/dev/null 2>&1 |
53 | else | |
1c727793 | 54 | msg_not_running "$MSG" |
e8be5dc3 | 55 | fi |
56 | ;; | |
d4702dae | 57 | status) |
58 | status $PROG | |
59 | exit $? | |
60 | ;; | |
2a40d39c | 61 | restart|force-reload) |
d4702dae | 62 | $0 stop |
63 | $0 start | |
2a40d39c | 64 | exit $? |
d4702dae | 65 | ;; |
66 | *) | |
2a40d39c | 67 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
68 | exit 3 | |
d4702dae | 69 | esac |
70 | ||
71 | exit $RETVAL |