Modify

Opened 10 years ago

Closed 10 years ago

#3057 closed defect (fixed)

isc dhcp server init script bug

Reported by: exobyte Owned by: developers
Priority: normal Milestone:
Component: packages Version:
Keywords: Cc:

Description

Figures... I caught my own 1+ year old bug.

Here's the fixed code:

#!/bin/sh /etc/rc.common
START=60

lease_file=/tmp/dhcpd.leases
config_file=/etc/dhcpd.conf
pid_file=/var/run/dhcpd.pid

start() {
        echo Starting isc-dhcpd

        if [ ! -e $lease_file ]; then
                echo "  Creating $lease_file"
                touch $lease_file
        fi

        /usr/sbin/dhcpd -q -cf $config_file -lf $lease_file

        if [ $? -ne 0 ]; then
                echo "  isc-dhcpd failed to start"
        fi
}

stop() {
        echo "Stopping isc-dhcpd"
        if [ -e $pid_file ]; then
                kill `cat $pid_file`

                if [ $? -ne 0 ]; then
                        echo "  PID " `cat $pid_file` not found
                        echo "  Is the DHCP server running?"
                fi

                rm $pid_file
        else
                echo "  $pid_file not found"
        fi
}


I was using $$ when I should have been using $?.

Attachments (0)

Change History (1)

comment:1 Changed 10 years ago by florian

  • Resolution set to fixed
  • Status changed from new to closed

Fixed with [10520], thanks !

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.