dhcpd/rc.dhcpd

changeset 354
4ca17af53013
parent 13
cb59d6afeb61
     1.1 --- a/dhcpd/rc.dhcpd	Thu Sep 15 11:03:52 2011 +0200
     1.2 +++ b/dhcpd/rc.dhcpd	Thu Sep 15 11:49:33 2011 +0200
     1.3 @@ -18,7 +18,8 @@
     1.4      dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid"
     1.5      dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases"
     1.6      dhcpd_signal () {
     1.7 -        [ -f $dhcpd_pidfile ] && kill -$1 `cat $dhcpd_pidfile`
     1.8 +        if [ ! -f $dhcpd_pidfile ]; then return 1; fi
     1.9 +        kill -$1 `cat $dhcpd_pidfile`
    1.10      }
    1.11      dhcpd_start () {
    1.12          if [ ! -f $dhcpd_leases ]; then
    1.13 @@ -27,6 +28,7 @@
    1.14              chown @l_susr@:@l_mgrp@ $dhcpd_leases
    1.15          fi
    1.16          local cmd="@l_prefix@/sbin/dhcpd"
    1.17 +        cmd="$cmd -f"
    1.18          cmd="$cmd $dhcpd_flags"
    1.19          echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1
    1.20          if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then
    1.21 @@ -35,14 +37,15 @@
    1.22          if [ $# -gt 0 ]; then
    1.23              cmd="$cmd $@"
    1.24          fi
    1.25 -        cmd="$cmd >/dev/null 2>&1"
    1.26 -        eval $cmd
    1.27 +        ( eval "nohup $cmd </dev/null >/dev/null 2>&1 &"
    1.28 +          echo $! >$dhcpd_pidfile
    1.29 +        ) >/dev/null 2>&1
    1.30      }
    1.31  
    1.32  %status -u @l_susr@ -o
    1.33      dhcpd_usable="unknown"
    1.34      dhcpd_active="no"
    1.35 -    dhcpd_start -q -t || dhcpd_usable="no"
    1.36 +    @l_prefix@/sbin/dhcpd -q -t || dhcpd_usable="no"
    1.37      [ ".$dhcpd_if" = . ] && dhcpd_usable="no"
    1.38      rcService dhcpd enable yes && \
    1.39          dhcpd_signal 0 && dhcpd_active="yes"

mercurial