1 #!/bin/sh /etc/rc.common
4 lease_file
=/tmp
/dhcpd.leases
5 config_file
=/etc
/dhcpd.conf
6 pid_file
=/var
/run
/dhcpd.pid
7 hosts_file
=/tmp
/dhcpd.hosts
12 config_get net
"$cfg" interface
13 [ -n "$net" ] ||
return 0
15 config_get_bool ignore
"$1" ignore
0
16 if [ "$ignore" -eq 1 ]; then return 0; fi
19 network_get_device dev
"$net" && append dhcp_ifs
"$dev"
25 config_get name
"$cfg" name
27 config_get ip
"$cfg" ip
28 [ -n "$ip" ] ||
return 0
31 config_get mac
"$cfg" mac
34 if [ $i -ne 0 ]; then hostid
="$name"_
"$i"; fi
36 echo "host $hostid {" >> "$hosts_file"
37 echo "hardware ethernet $m;" >> "$hosts_file"
38 echo "fixed-address $ip;" >> "$hosts_file"
39 echo "}" >> $hosts_file
46 echo " #Automatically generated by dhcpd initscript, any modifications will be overwritten" > "$hosts_file"
48 .
/lib
/functions
/network.sh
51 config_foreach parse_host_entry
host
52 config_foreach parse_dhcp dhcp
56 if [ -e $pid_file ] ; then
57 echo " dhcpd already running with PID `cat $pid_file`"
61 echo Starting isc-dhcpd
63 if [ ! -e $lease_file ]; then
64 echo " Creating $lease_file"
68 /usr
/sbin
/dhcpd
-q -cf $config_file -lf $lease_file
71 echo " isc-dhcpd failed to start"
76 echo "Stopping isc-dhcpd"
77 if [ -e $pid_file ]; then
78 kill -KILL `cat $pid_file`
81 echo " PID " `cat $pid_file` not found
82 echo " Is the DHCP server running?"
87 echo " $pid_file not found"