diff options
author | Warren Baker <warren@decoy.co.za> | 2011-01-31 18:40:03 +0200 |
---|---|---|
committer | Warren Baker <warren@decoy.co.za> | 2011-01-31 18:43:23 +0200 |
commit | c6563f0523bdd24a88bb4766509494c23d43e38f (patch) | |
tree | 98965bcea06e3832c87ea310b1e3028fd165b56b /config/unbound/unbound.inc | |
parent | 0c13d82ce630cc9b5480971b935353f3277cf65a (diff) | |
download | pfsense-packages-c6563f0523bdd24a88bb4766509494c23d43e38f.tar.gz pfsense-packages-c6563f0523bdd24a88bb4766509494c23d43e38f.tar.bz2 pfsense-packages-c6563f0523bdd24a88bb4766509494c23d43e38f.zip |
Remove manual user deletion (its handled by the pkg removal process). Also added Cache Restoration support, so the existing cache is dumped to disk and restored in case of a service restart, reboot or shutdown of the server.
Diffstat (limited to 'config/unbound/unbound.inc')
-rw-r--r-- | config/unbound/unbound.inc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index 8cb14aae..eafafcb9 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -119,6 +119,7 @@ function unbound_rc_setup() { fetch_root_hints(); unbound_control(\"start\"); unbound_control(\"forward\"); + unbound_control(\"restore_cache\"); echo \"done.\\n\"; ?> ENDPHP\n"; @@ -127,6 +128,7 @@ $stop = "/usr/local/bin/php -q -d auto_prepend_file=config.inc <<ENDPHP <?php require_once(\"/usr/local/pkg/unbound.inc\"); echo \"Stopping Unbound...\"; + unbound_control(\"dump_cache\"); unbound_control(\"termstop\"); echo \"done.\\n\"; ?> @@ -154,6 +156,7 @@ function unbound_control($action) { global $config, $g; $unbound_config = $config['installedpackages']['unbound']['config'][0]; + $cache_dumpfile = "/var/tmp/unbound_cache"; switch ($action) { case "forward": @@ -206,6 +209,21 @@ function unbound_control($action) { //Stop Unbound by sigkillbypid(); sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM"); break; + + case "dump_cache": + //Dump Unbound's Cache + if($unbound_config['dumpcache'] == "on") + unbound_ctl_exec("dump_cache > $cache_dumpfile"); + break; + + case "restore_cache": + //Restore Unbound's Cache + if($unbound_config['dumpcache'] == "on") { + $cache_dumpfile = "/var/tmp/unbound_cache"; + if(file_exists($cache_dumpfile)) + unbound_ctl_exec("load_cache < $cache_dumpfile"); + } + break; default: break; @@ -555,14 +573,17 @@ function unbound_reconfigure() { if ($unbound_config['unbound_status'] != "on") { if(is_service_running("unbound")) { + unbound_control("dump_cache"); unbound_control("termstop"); } } else { if(is_service_running("unbound")) { + unbound_control("dump_cache"); unbound_control("termstop"); } unbound_resync_config(); unbound_control("start"); + unbound_control("restore_cache"); unbound_control("forward"); } } @@ -578,9 +599,6 @@ function unbound_uninstall() { mwexec("rm -f /usr/local/etc/rc.d/unbound.sh"); mwexec("rm -f {$g['varlog_path']}/unbound.log"); - // Remove unbound user - exec("/usr/sbin/pw userdel unbound"); - conf_mount_ro(); } |