Subversion Repositories configs

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#!/bin/sh
2
#
3
### BEGIN INIT INFO
4
# Provides: dhcrelay
5
# Default-Start:
6
# Default-Stop:
7
# Should-Start:
8
# Required-Start: $network
9
# Required-Stop:
10
# Short-Description: Start and stop the DHCP relay server
11
# Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP)
12
#              relay server.  This is required when your DHCP server is on
13
#              another network segment from the clients.
14
### END INIT INFO
15
#
16
# The fields below are left around for legacy tools (will remove later).
17
#
18
# chkconfig: - 65 35
19
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
20
# processname: dhcrelay
21
# # pidfile: /var/run/dhcrelay.pid
22
 
23
. /etc/rc.d/init.d/functions
24
 
25
RETVAL=0
26
 
27
prog=dhcrelay
28
exec=/usr/sbin/dhcrelay
29
lockfile=/var/lock/subsys/dhcrelay
30
pidfile=/var/run/dhcrelay.pid
31
config=/etc/sysconfig/dhcrelay
32
 
33
# The dhcrelay daemon uses the sysconfig file for configuration information.
34
# There is no native configuration file for this program and you must specify
35
# its settings on the command line.
36
[ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay
37
 
38
configtest() {
39
    [ -x $exec ] || exit 5
40
    [ -f $config ] || exit 6
41
    [ -z "$DHCPSERVERS" ] && exit 6
42
    return 0
43
}
44
 
45
rh_status() {
33 - 46
    status -p $pidfile $exec
3 - 47
}
48
 
49
rh_status_q() {
50
    rh_status >/dev/null 2>&1
51
}
52
 
53
start() {
54
    [ `id -u` -eq 0 ] || exit 4
55
    [ -x $exec ] || exit 5
56
    [ -f $config ] || exit 6
57
 
58
    rh_status_q && return 0
59
 
60
    echo -n $"Starting $prog: "
33 - 61
    daemon --pidfile=$pidfile $exec $DHCRELAYARGS $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS 2>/dev/null
3 - 62
    RETVAL=$?
63
    echo
64
    [ $RETVAL -eq 0 ] && touch $lockfile
65
    return $RETVAL
66
}
67
 
68
stop() {
69
    [ `id -u` -eq 0 ] || exit 4
70
 
71
    rh_status_q || return 0
72
 
73
    echo -n $"Shutting down $prog: "
33 - 74
    killproc -p $pidfile $prog
3 - 75
    RETVAL=$?
76
 
77
    echo
78
    [ $RETVAL -eq 0 ] && rm -f $lockfile
79
    return $RETVAL
80
}
81
 
82
usage() {
83
    echo $"Usage: $0 {start|stop|restart|force-reload|condrestart|try-restart|configtest|status}"
84
}
85
 
86
if [ $# -gt 1 ]; then
87
    exit 2
88
fi
89
 
90
case "$1" in
91
    start)
92
        start
93
        ;;
94
    stop)
95
        stop
96
        ;;
97
    restart|force-reload)
98
        stop ; start
99
        ;;
100
    condrestart|try-restart)
101
        rh_status_q || exit 0
102
        stop ; start
103
        ;;
104
    reload)
105
        usage
106
        # unimplemented feature
107
        exit 3
108
        ;;
109
    configtest)
110
        configtest
111
        ;;
112
    status)
113
        rh_status
114
        ;;
115
    *)
116
        usage
117
        exit 2
118
        ;;
119
esac
120
 
121
exit $?