diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-01-28 02:35:21 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-01-28 02:35:21 +0000 |
commit | 356b821123c240f69f63c3329d3365eb4c6bea7a (patch) | |
tree | 2b6a2b6e3d920bd15b57f38b5cbba903547f89a4 /packages/tinydns/tinydns.inc | |
parent | 623eea27ddeec21c189f80e26f06956ec55273f9 (diff) | |
download | pfsense-packages-356b821123c240f69f63c3329d3365eb4c6bea7a.tar.gz pfsense-packages-356b821123c240f69f63c3329d3365eb4c6bea7a.tar.bz2 pfsense-packages-356b821123c240f69f63c3329d3365eb4c6bea7a.zip |
Lock the config while writing out files that could already being written by a different process.
Diffstat (limited to 'packages/tinydns/tinydns.inc')
-rw-r--r-- | packages/tinydns/tinydns.inc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 1c5155db..37c3d542 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -103,6 +103,7 @@ EOD; fclose($fd); conf_mount_ro(); filter_configure(); + } function tinydns_custom_php_deinstall_command() { @@ -132,21 +133,22 @@ function tinydns_custom_php_changeip_command() { exec("/bin/mkdir /service"); exec("/bin/ln -s /etc/tinydns /service/"); if($updatecron) { - $text_1 = "*/1 * * * * root /usr/bin/nice -n20 /etc/ping_hosts.sh"; - $text_5 = "*/5 * * * * root /usr/bin/nice -n20 /etc/ping_hosts.sh"; + $text_1 = "*/1 * * * * root /etc/ping_hosts.sh"; + $text_5 = "*/5 * * * * root /etc/ping_hosts.sh"; $filenamea = "/etc/crontab"; remove_text_from_file($filenamea, $text_1); remove_text_from_file($filenamea, $text_5); add_text_to_file($filenamea, $text_1); } else { - $text_1 = "*/1 * * * * root /usr/bin/nice -n20 /etc/ping_hosts.sh"; - $text_5 = "*/5 * * * * root /usr/bin/nice -n20 /etc/ping_hosts.sh"; + $text_1 = "*/1 * * * * root /etc/ping_hosts.sh"; + $text_5 = "*/5 * * * * root /etc/ping_hosts.sh"; $filenamea = "/etc/crontab"; remove_text_from_file($filenamea, $text_1); remove_text_from_file($filenamea, $text_5); add_text_to_file($filenamea, $text_5); } - exec("killall -HUP cron"); + exec("killall cron"); + exec("cron"); conf_mount_ro(); filter_configure(); } @@ -204,6 +206,7 @@ function tinydns_setup_ping_items() { log_error("Could not open /var/db/pkgpinghosts for writing."); return; } + config_lock(); /* write out each ip address so ping_hosts.sh can begin monitoring ip * status and create a database of the status information that we can use. */ @@ -246,12 +249,15 @@ function tinydns_setup_ping_items() { } } fclose($fd); + config_unlock(); conf_mount_ro(); } function tinydns_create_zone_file() { global $g, $config; conf_mount_rw(); + config_lock(); + exec("rm -f /service/tinydns/root/data"); $fd = fopen("/service/tinydns/root/data", "w"); if(!$fd) { log_error("Could not open /service/tinydns/root/data for writing."); @@ -271,7 +277,7 @@ function tinydns_create_zone_file() { if($monitorip) { $status = tinydns_get_record_status($monitorip); if($status == "DOWN") - $ipaddress = tinydns_get_backup_record($ipaddress); + $ipaddress = tinydns_get_backup_record($ipaddress); } $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname); if($record_data) @@ -301,6 +307,7 @@ function tinydns_create_zone_file() { fclose($fd); /* tell tinydns to reload zone file */ exec("cd /service/tinydns/root && /usr/local/bin/tinydns-data"); + config_unlock(); conf_mount_ro(); } |