]> git.pld-linux.org Git - packages/dhcp-helper.git/blame - dhcp-helper.init
- initial, init script to run dhcp-helper
[packages/dhcp-helper.git] / dhcp-helper.init
CommitLineData
8a68e5be 1#!/bin/sh
2# DHCP Server
3#
4# chkconfig: 345 80 20
5# description: DHCP relay helper
6
7# Source function library
8. /etc/rc.d/init.d/functions
9
10# Get network config
11. /etc/sysconfig/network
12
13# Get service config
14[ -f /etc/sysconfig/dhcp-helper ] && . /etc/sysconfig/dhcp-helper
15
16# Check that networking is up.
17if is_yes "${NETWORKING}"; then
18 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
19 msg_network_down DHCPD
20 exit 1
21 fi
22else
23 exit 0
24fi
25
26RETVAL=0
27# See how we were called.
28case "$1" in
29 start)
30 # Check if the service is already running?
31 if [ ! -f /var/lock/subsys/dhcp-helper ]; then
32 msg_starting "DHCP helper"
33
34 [ -n "${RELAY_TO_SERVERS}" ] && DHCPH_OPTIONS="${DHCPH_OPTIONS} -s ${RELAY_TO_SERVERS}"
35 [ -n "${BROADCAST_TO_INTERFACE}" ] && DHCPH_OPTIONS="${DHCPH_OPTIONS} -b ${BROADCAST_TO_INTERFACE}"
36 [ -n "${LISTEN_INTERFACES}" ] && DHCPH_OPTIONS="${DHCPH_OPTIONS} -i ${LISTEN_INTERFACES}"
37 [ -n "${EXCLUDE_INTERFACES}" ] && DHCPH_OPTIONS="${DHCPH_OPTIONS} -e ${EXCLUDE_INTERFACES}"
38
39 daemon dhcp-helper ${DHCPH_OPTIONS}
40 RETVAL=$?
41 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp-helper
42 else
43 msg_already_running "DHCP helper"
44 fi
45 ;;
46 stop)
47 if [ -f /var/lock/subsys/dhcpd ]; then
48 msg_stopping "DHCP helper"
49 killproc dhcp-helper
50 rm -f /var/run/dhcpd.pid /var/lock/subsys/dhcp-helper >/dev/null 2>&1
51 else
52 msg_not_running "DHCP helper"
53 fi
54 ;;
55 restart|reload)
56 $0 stop
57 $0 start
58 exit $?
59 ;;
60 status)
61 status dhcp-helper
62 exit $?
63 ;;
64 *)
65 msg_usage "$0 {start|stop|restart|force-reload|status}"
66 exit 3
67esac
68
69exit $RETVAL
This page took 0.074078 seconds and 4 git commands to generate.