1#!/bin/sh
2# 
3# dproxy           This shell script takes care of starting and stopping
4#                  dproxy (DNS caching proxy).
5# 
6# chkconfig: 345 55 45
7# 
8# description: dproxy is a caching Domain Name Server (DNS)  proxy
9# that is used to resolve host names to IP addresses.
10# probe: true
11# 
12
13DAEMON=dproxy
14DPROXY=BIN_DIR/$DAEMON
15DPROXY_CONF=CONFIG_DIR/$DAEMON.conf
16
17ifdef(`REDHAT',`
18# Source function library.
19. /etc/rc.d/init.d/functions
20
21# Source networking configuration.
22. /etc/sysconfig/network
23
24# Check that networking is up.
25[ ${NETWORKING} = "no" ] && exit 0
26
27DSTART="daemon $DPROXY -c $DPROXY_CONF"
28DSTOP="killproc $DPROXY"
29
30LOCKFILE="/var/lock/subsys/dproxy"
31LOCK="touch $LOCKFILE"
32UNLOCK="rm -f $LOCKFILE"
33',`')
34ifdef(`DEBIAN',`
35DSTART="start-stop-daemon -S -x $DPROXY -n $DAEMON -- -c $DPROXY_CONF"
36DSTOP="start-stop-daemon -K -x $DPROXY -n $DAEMON -- -c $DPROXY_CONF"
37LOCK=""
38UNLOCK=""
39')
40ifdef(`SUSE',`
41DSTART="start-stop-daemon -S -x $DPROXY -n $DAEMON -- -c $DPROXY_CONF"
42DSTOP="start-stop-daemon -K -x $DPROXY -n $DAEMON -- -c $DPROXY_CONF"
43LOCK=""
44UNLOCK=""
45')
46
47
48[ -x "$DPROXY" ] || exit 0
49
50# for the future.... I like to aim high ;-)
51[ -f "$DPROXY_CONF" ] || exit 0
52
53# See how we were called.
54case "$1" in
55  start)
56        # Start daemons.
57        echo -n "Starting dproxy: "
58        eval $DSTART 
59        echo
60	eval $LOCK
61        ;;
62  stop)
63        # Stop daemons.
64        echo -n "Shutting down dproxy: "
65        eval $DSTOP 
66	eval $UNLOCK
67        echo
68        ;;
69ifdef(`REDHAT',`
70  status)
71        status $DPROXY
72        ;;
73',`')
74  reload|restart)
75        $0 stop
76        $0 start
77        ;;
78  *)
79        echo "Usage: $0 {start|stop|status|restart}"
80        exit 1
81esac
82
83exit 0
84