aboutsummaryrefslogtreecommitdiffstats
path: root/config/squid3
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-10-11 15:57:46 +0200
committerdoktornotor <notordoktor@gmail.com>2015-10-11 15:57:46 +0200
commit6d301cca472737f59d7bd05af34685c5d716aba9 (patch)
tree99c96aaeb8b629d329e6cc788f8d9537299e64b1 /config/squid3
parent4350fa2eeac5ebf945292a3760917a13af813371 (diff)
downloadpfsense-packages-6d301cca472737f59d7bd05af34685c5d716aba9.tar.gz
pfsense-packages-6d301cca472737f59d7bd05af34685c5d716aba9.tar.bz2
pfsense-packages-6d301cca472737f59d7bd05af34685c5d716aba9.zip
Re-add swapstate_check.php cronjob, add manually clear disk cache feature
- The swapstate_check.php cronjob, is here purely to prevent Squid from filling disk completely on misconfigured boxes; the script will only clear the disk cache on the following conditions:either if the swap.state file is taking up more than 75% of disk space, or the drive is 90% full and swap.state is larger than 1GB. - Added a button to manually clear disk cache from the GUI
Diffstat (limited to 'config/squid3')
-rwxr-xr-xconfig/squid3/34/squid.inc19
1 files changed, 19 insertions, 0 deletions
diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc
index cbb24a04..e28cf56e 100755
--- a/config/squid3/34/squid.inc
+++ b/config/squid3/34/squid.inc
@@ -324,10 +324,22 @@ function squid_install_cron($should_install) {
}
$cron_cmd = SQUID_BASE . "/sbin/squid -k rotate -f " . SQUID_CONFFILE;
+ /*
+ * This is here to prevent Squid from filling disk completely on misconfigured boxes.
+ * When 'Hard Disk Cache System' is set to null, the script silently returns, no need to check here.
+ * Otherwise, swapstate_check.php will only clear the disk cache on the following conditions:
+ * - if the swap.state file is taking up more than 75% of disk space,
+ * - or the drive is 90% full and swap.state is larger than 1GB.
+ */
+ $swapstate_cmd = "/usr/local/pkg/swapstate_check.php";
if (($should_install) && (squid_enabled())) {
+ log_error("[squid] Adding cronjobs ...");
install_cron_job("{$cron_cmd}", $should_install, "0", "0", "*", "*", "*", "root");
+ install_cron_job("{$swapstate_cmd}", $should_install, "15", "0", "*", "*", "*", "root");
} else {
+ log_error("[squid] Removing cronjobs ...");
install_cron_job("{$cron_cmd}", false);
+ install_cron_job("{$swapstate_cmd}", false);
}
}
@@ -861,6 +873,13 @@ function squid_validate_upstream($post, &$input_errors) {
/* Proxy Server: Cache Management input validation */
function squid_validate_cache($post, &$input_errors) {
+ /* Manually clear hard disk cache */
+ if ($post['clear_cache'] == 'Clear Disk Cache NOW') {
+ log_error("[squid] Clear disk cache forced via GUI. Clearing cache now...");
+ squid_dash_z("clean");
+ return;
+ }
+
$num_fields = array(
'harddisk_cache_size' => 'Hard disk cache size',
'memory_cache_size' => 'Memory cache size',