source: packages/net/dhcp/files/dhcpd.init @ 9242

Last change on this file since 9242 was 9242, checked in by florian, 9 years ago

Add init script from #924

File size: 624 bytes
Line 
1#!/bin/sh /etc/rc.common
2START=60
3
4lease_file=/tmp/dhcpd.leases
5config_file=/etc/dhcpd.conf
6pid_file=/var/run/dhcpd.pid
7
8start() {
9        echo Starting isc-dhcpd
10
11        if [ ! -e $lease_file ]; then
12                echo "  Creating $lease_file"
13                touch $lease_file
14        fi
15       
16        /usr/sbin/dhcpd -cf $config_file -lf $lease_file
17       
18        if [ $$ -eq 0 ]; then
19                echo "  isc-dhcpd failed to start"
20        fi
21}
22
23stop() {
24        echo "Stopping isc-dhcpd"
25        if [ -e $pid_file ]; then
26                kill `cat $pid_file`
27
28                if [ $$ -eq 0 ]; then
29                        echo "  PID " `cat $pid_file` not found
30                        echo "  Is the DHCP server running?"
31                fi
32       
33                rm $pid_file
34        else
35                echo "  $pid_file not found"
36        fi
37}
Note: See TracBrowser for help on using the repository browser.