Add init script from exobyte #924
[openwrt/svn-archive/archive.git] / net / bind / files / named.init
1 #!/bin/sh /etc/rc.common
2
3 lease_file=/tmp/dhcpd.leases
4 config_file=/etc/dhcpd.conf
5 pid_file=/var/run/dhcpd.pid
6
7 start() {
8 echo Starting isc-dhcpd
9
10 if [ ! -e $lease_file ]; then
11 echo " Creating $lease_file"
12 touch $lease_file
13 fi
14
15 /usr/sbin/dhcpd -cf $config_file -lf $lease_file
16
17 if [ $$ -eq 0 ]
18 then
19 echo " isc-dhcpd failed to start"
20 fi
21 }
22
23 stop() {
24 echo "Stopping isc-dhcpd"
25 if [ -e $pid_file ]
26 then
27 kill `cat $pid_file`
28
29 if [ $$ -eq 0 ]
30 then
31 echo " PID " `cat $pid_file` not found
32 echo " Is the DHCP server running?"
33 fi
34
35 rm $pid_file
36
37 else
38 echo " $pid_file not found"
39 fi
40 }