Subversion Repositories configs

Rev

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

Rev Author Line No. Line
8 - 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 for IPv6
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/dhcrelay6.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/dhcrelay6
30
pidfile=/var/run/dhcrelay6.pid
31
config=/etc/sysconfig/dhcrelay6
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 $config ] && . $config
37
 
38
configtest() {
39
    [ -x $exec ] || exit 5
40
    [ -f $config ] || exit 6
41
    [ -z "$UPPER_INTERFACES" ] && exit 6
42
    [ -z "$LOWER_INTERFACES" ] && exit 6
43
    return 0
44
}
45
 
46
rh_status() {
33 - 47
    status -p $pidfile -l $(basename $lockfile) $exec
8 - 48
}
49
 
50
rh_status_q() {
51
    rh_status >/dev/null 2>&1
52
}
53
 
54
start() {
55
    [ `id -u` -eq 0 ] || exit 4
56
    [ -x $exec ] || exit 5
57
    [ -f $config ] || exit 6
58
 
59
    rh_status_q && return 0
60
 
33 - 61
    echo -n $"Starting $prog (DHCPv6): "
62
    daemon --pidfile=$pidfile $exec -6 $DHCRELAYARGS $(for int in $LOWER_INTERFACES ; do echo -n " -l $int" ; done) \
8 - 63
        $(for int in $UPPER_INTERFACES ; do echo -n " -u $int" ; done)  2>/dev/null
64
    RETVAL=$?
65
    echo
66
    [ $RETVAL -eq 0 ] && touch $lockfile
67
    return $RETVAL
68
}
69
 
70
stop() {
71
    [ `id -u` -eq 0 ] || exit 4
72
 
73
    rh_status_q || return 0
74
 
33 - 75
    echo -n $"Shutting down $prog (DHCPv6): "
76
    killproc -p $pidfile $prog
8 - 77
    RETVAL=$?
78
 
79
    echo
80
    [ $RETVAL -eq 0 ] && rm -f $lockfile
81
    return $RETVAL
82
}
83
 
84
usage() {
85
    echo $"Usage: $0 {start|stop|restart|force-reload|condrestart|try-restart|configtest|status}"
86
}
87
 
88
if [ $# -gt 1 ]; then
89
    exit 2
90
fi
91
 
92
case "$1" in
93
    start)
94
        start
95
        ;;
96
    stop)
97
        stop
98
        ;;
99
    restart|force-reload)
100
        stop ; start
101
        ;;
102
    condrestart|try-restart)
103
        rh_status_q || exit 0
104
        stop ; start
105
        ;;
106
    reload)
107
        usage
108
        # unimplemented feature
109
        exit 3
110
        ;;
111
    configtest)
112
        configtest
113
        ;;
114
    status)
115
        rh_status
116
        ;;
117
    *)
118
        usage
119
        exit 2
120
        ;;
121
esac
122
 
123
exit $?