- Init script fixes for dhcpd and dhcrelay (#278601)
This commit is contained in:
parent
546813ff14
commit
e6a433a23b
@ -13,7 +13,7 @@
|
|||||||
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
|
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
|
||||||
Name: dhcp
|
Name: dhcp
|
||||||
Version: 3.0.6
|
Version: 3.0.6
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
Epoch: 12
|
Epoch: 12
|
||||||
License: ISC
|
License: ISC
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
@ -431,6 +431,9 @@ fi
|
|||||||
%{_libdir}/libdhcp4client.a
|
%{_libdir}/libdhcp4client.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Sep 26 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.6-6
|
||||||
|
- Init script fixes for dhcpd and dhcrelay (#278601)
|
||||||
|
|
||||||
* Mon Sep 10 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.6-5
|
* Mon Sep 10 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.6-5
|
||||||
- Fix typos in ldap.c and correct LDAP macros (#283391)
|
- Fix typos in ldap.c and correct LDAP macros (#283391)
|
||||||
|
|
||||||
|
106
dhcpd.init
106
dhcpd.init
@ -1,37 +1,54 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: dhcpd
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Should-Start:
|
||||||
|
# Required-Start: $network
|
||||||
|
# Required-Stop:
|
||||||
|
# Short-Description: Start and stop the DHCP server
|
||||||
|
# Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
|
||||||
|
# server.
|
||||||
|
### END INIT INFO
|
||||||
|
#
|
||||||
|
# The fields below are left around for legacy tools (will remove later).
|
||||||
#
|
#
|
||||||
# chkconfig: - 65 35
|
# chkconfig: - 65 35
|
||||||
# description: dhcpd provide access to Dynamic Host Control Protocol.
|
# description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \
|
||||||
|
# server
|
||||||
|
# processname: dhcpd
|
||||||
|
# config: /etc/dhcpd.conf
|
||||||
|
# config: /var/lib/dhcpd/dhcpd.leases
|
||||||
|
# pidfile: /var/run/dhcpd.pid
|
||||||
|
|
||||||
# Source function library.
|
|
||||||
. /etc/init.d/functions
|
. /etc/init.d/functions
|
||||||
|
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
|
||||||
prog=dhcpd
|
prog=dhcpd
|
||||||
dhcpd=/usr/sbin/dhcpd
|
dhcpd=/usr/sbin/dhcpd
|
||||||
lockfile=/var/lock/subsys/dhcpd
|
lockfile=/var/lock/subsys/dhcpd
|
||||||
|
pidfile=/var/run/dhcpd.pid
|
||||||
|
|
||||||
. /etc/sysconfig/dhcpd
|
[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
|
||||||
|
|
||||||
cfOption() {
|
# if the user specified a different config file, make sure we reference it
|
||||||
let i=0
|
findConfig() {
|
||||||
for a in $* ; do
|
for arg in $DHCPDARGS ; do
|
||||||
((++i))
|
if [ $found = 1 ]; then
|
||||||
if [ $a = -cf ]; then
|
[ -f "$arg" ] && echo "$arg"
|
||||||
((++i))
|
return
|
||||||
eval 'echo $'$i
|
fi
|
||||||
elif [[ $a = -cf* ]]; then
|
if [ "$arg" = "-cf" ]; then
|
||||||
echo ${a#-cf}
|
found=1
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo "/etc/dhcpd.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
CF=`cfOption $DHCPDARGS`
|
conf="$(findConfig "$DHCPDARGS")"
|
||||||
if [ -z "$CF" ]; then
|
|
||||||
CF='/etc/dhcpd.conf'
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -f "$CF" ] || exit 0
|
|
||||||
|
|
||||||
if [ ! -f /var/lib/dhcpd/dhcpd.leases ] ; then
|
if [ ! -f /var/lib/dhcpd/dhcpd.leases ] ; then
|
||||||
mkdir -p /var/lib/dhcpd
|
mkdir -p /var/lib/dhcpd
|
||||||
@ -41,15 +58,20 @@ fi
|
|||||||
|
|
||||||
configtest() {
|
configtest() {
|
||||||
[ -x $dhcpd ] || return 5
|
[ -x $dhcpd ] || return 5
|
||||||
[ -f $CF ] || return 6
|
[ -f $conf ] || return 6
|
||||||
$dhcpd -q -t -cf $CF
|
$dhcpd -q -t -cf $conf
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
[ -x $dhcpd ] || return 5
|
[ -x $dhcpd ] || return 5
|
||||||
[ -f $CF ] || return 6
|
[ -f $conf ] || return 6
|
||||||
|
|
||||||
|
pidofproc $prog >/dev/null 2>&1
|
||||||
|
RETVAL=$?
|
||||||
|
[ $RETVAL -eq 0 ] && return $RETVAL
|
||||||
|
|
||||||
echo -n $"Starting $prog: "
|
echo -n $"Starting $prog: "
|
||||||
daemon $dhcpd $DHCPDARGS 2>/dev/null
|
daemon $dhcpd $DHCPDARGS 2>/dev/null
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
@ -59,42 +81,60 @@ start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
pidofproc $prog >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
RETVAL=7
|
||||||
|
return $RETVAL
|
||||||
|
fi
|
||||||
|
|
||||||
echo -n $"Shutting down $prog: "
|
echo -n $"Shutting down $prog: "
|
||||||
killproc $prog
|
killproc $prog
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
|
||||||
|
[ $RETVAL = 0 ] && success || failure
|
||||||
echo
|
echo
|
||||||
[ $RETVAL = 0 ] && rm -f $lockfile
|
[ $RETVAL = 0 ] && rm -f $lockfile
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
# See how we were called.
|
if [ ! -x $dhcdbd ]; then
|
||||||
|
RETVAL=5
|
||||||
|
exit $RETVAL
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
RETVAL=2
|
||||||
|
exit $RETVAL
|
||||||
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
start
|
start
|
||||||
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stop
|
stop
|
||||||
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
reload)
|
restart|force-reload)
|
||||||
|
stop && start
|
||||||
|
RETVAL=$?
|
||||||
|
;;
|
||||||
|
try-restart|reload)
|
||||||
RETVAL=3
|
RETVAL=3
|
||||||
;;
|
;;
|
||||||
restart)
|
|
||||||
configtest || exit $?
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
condrestart)
|
condrestart)
|
||||||
if [ -f $lockfile ]; then
|
if [ -f $lockfile ]; then
|
||||||
stop
|
stop && start
|
||||||
start
|
RETVAL=$?
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
configtest|check|testconfig|test)
|
configtest)
|
||||||
configtest
|
configtest
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
status $prog
|
status $dhcpd
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -1,23 +1,58 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: dhcrelay
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Should-Start:
|
||||||
|
# Required-Start: $network
|
||||||
|
# Required-Stop:
|
||||||
|
# Short-Description: Start and stop the DHCP relay server
|
||||||
|
# Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP)
|
||||||
|
# relay server. This is required when your DHCP server is on
|
||||||
|
# another network segment from the clients.
|
||||||
|
### END INIT INFO
|
||||||
|
#
|
||||||
|
# The fields below are left around for legacy tools (will remove later).
|
||||||
#
|
#
|
||||||
# chkconfig: - 66 34
|
# chkconfig: - 66 34
|
||||||
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
|
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
|
||||||
|
# processname: dhcrelay
|
||||||
|
# # pidfile: /var/run/dhcrelay.pid
|
||||||
|
|
||||||
# Source function library
|
|
||||||
. /etc/init.d/functions
|
. /etc/init.d/functions
|
||||||
|
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
|
||||||
prog=dhcrelay
|
prog=dhcrelay
|
||||||
dhcrelay=/usr/sbin/dhcrelay
|
dhcrelay=/usr/sbin/dhcrelay
|
||||||
lockfile=/var/lock/subsys/dhcrelay
|
lockfile=/var/lock/subsys/dhcrelay
|
||||||
|
pidfile=/var/run/dhcrelay.pid
|
||||||
|
conf=/etc/sysconfig/dhcrelay
|
||||||
|
|
||||||
|
# The dhcrelay daemon uses the sysconfig file for configuration information.
|
||||||
|
# There is no native configuration file for this program and you must specify
|
||||||
|
# its settings on the command line.
|
||||||
|
[ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay
|
||||||
|
|
||||||
|
configtest() {
|
||||||
|
[ -x $dhcrelay ] || exit 5
|
||||||
|
[ -f $conf ] || exit 6
|
||||||
|
[ -z "$DHCPSERVERS" ] && exit 6
|
||||||
|
RETVAL=0
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
[ -x $dhcrelay ] || exit 5
|
[ -x $dhcrelay ] || exit 5
|
||||||
[ -f /etc/sysconfig/dhcrelay ] || exit 6
|
[ -f $conf ] || exit 6
|
||||||
. /etc/sysconfig/dhcrelay
|
|
||||||
[ -z "$DHCPSERVERS" ] && exit 6
|
pidofproc $prog >/dev/null 2>&1
|
||||||
|
RETVAL=$?
|
||||||
|
[ $RETVAL -eq 0 ] && return $RETVAL
|
||||||
|
|
||||||
echo -n $"Starting $prog: "
|
echo -n $"Starting $prog: "
|
||||||
daemon $dhcrelay $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS
|
daemon $dhcrelay $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS 2>/dev/null
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 ] && touch $lockfile
|
[ $RETVAL -eq 0 ] && touch $lockfile
|
||||||
@ -25,41 +60,64 @@ start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
pidofproc $prog >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
RETVAL=7
|
||||||
|
return $RETVAL
|
||||||
|
fi
|
||||||
|
|
||||||
echo -n $"Shutting down $prog: "
|
echo -n $"Shutting down $prog: "
|
||||||
killproc $prog -TERM
|
killproc $prog -TERM
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
|
||||||
|
[ $RETVAL = 0 ] && success || failure
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
[ $RETVAL = 0 ] && rm -f $lockfile
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
# See how we were called.
|
if [ ! -x $dhcrelay ]; then
|
||||||
|
RETVAL=5
|
||||||
|
exit $RETVAL
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
RETVAL=2
|
||||||
|
exit $RETVAL
|
||||||
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
start
|
start
|
||||||
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stop
|
stop
|
||||||
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
reload)
|
restart|force-reload)
|
||||||
|
stop && start
|
||||||
|
RETVAL=$?
|
||||||
|
;;
|
||||||
|
try-restart|reload)
|
||||||
RETVAL=3
|
RETVAL=3
|
||||||
;;
|
;;
|
||||||
restart)
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
condrestart)
|
condrestart)
|
||||||
if [ -f $lockfile ]; then
|
if [ -f $lockfile ]; then
|
||||||
stop
|
stop && start
|
||||||
start
|
RETVAL=$?
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
configtest)
|
||||||
|
configtest
|
||||||
|
RETVAL=$?
|
||||||
|
;;
|
||||||
status)
|
status)
|
||||||
status $prog
|
status $prog
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
|
||||||
RETVAL=3
|
RETVAL=3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user