diff options
author | jim-p <jimp@pfsense.org> | 2014-04-07 10:10:48 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2014-04-08 09:25:02 -0400 |
commit | 8294066e3e8dd450269f64329d80fc2395d6e622 (patch) | |
tree | 2268c9d3b3e7554e0c1d0226ae675af3b499c6b6 /etc/inc | |
parent | e222576cde842f895371ba80d8f2a56571377e21 (diff) | |
download | pfsense-8294066e3e8dd450269f64329d80fc2395d6e622.zip pfsense-8294066e3e8dd450269f64329d80fc2395d6e622.tar.gz |
Make extra sure that we do not start multiple instances of dhcpleases if, for example, the PID is stale/invalid and there is still a running instance.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/system.inc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 57b55ce..48376a0 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -335,8 +335,13 @@ function system_dhcpleases_configure() { @touch("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"); if (isvalidpid("{$g['varrun_path']}/dhcpleases.pid")) sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "HUP"); - else + else { + /* To ensure we do not start multiple instances of dhcpleases, perform some clean-up first. */ + if (is_process_running("dhcpleases")) + mwexec('/bin/pkill dhcpleases'); + @unlink("{$g['varrun_path']}/dhcpleases.pid"); mwexec("/usr/local/sbin/dhcpleases -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases -d {$config['system']['domain']} -p {$g['varrun_path']}/dnsmasq.pid -h {$g['varetc_path']}/hosts"); + } } else { sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "TERM"); @unlink("{$g['varrun_path']}/dhcpleases.pid"); |