aboutsummaryrefslogtreecommitdiffstats
path: root/config/squid3/33/swapstate_check.php
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2014-04-03 15:57:01 -0300
committerMarcello Coutinho <marcellocoutinho@gmail.com>2014-04-03 15:57:01 -0300
commit2ba6733c7edfe1d7e1ffa0963bf2ed1d75035e55 (patch)
tree571f15986cc6373250e9deadf35254ce4ed12039 /config/squid3/33/swapstate_check.php
parentfaf39f50bf82af08ada1a957fd4e2a8610cab1b4 (diff)
downloadpfsense-packages-2ba6733c7edfe1d7e1ffa0963bf2ed1d75035e55.tar.gz
pfsense-packages-2ba6733c7edfe1d7e1ffa0963bf2ed1d75035e55.tar.bz2
pfsense-packages-2ba6733c7edfe1d7e1ffa0963bf2ed1d75035e55.zip
squid3-dev - Improve cache tests and cleanup
https://forum.pfsense.org/index.php?topic=74453.msg407275#msg407275 Thanks to Bellera
Diffstat (limited to 'config/squid3/33/swapstate_check.php')
-rw-r--r--config/squid3/33/swapstate_check.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/config/squid3/33/swapstate_check.php b/config/squid3/33/swapstate_check.php
index 6ecfff3c..a0b3c98b 100644
--- a/config/squid3/33/swapstate_check.php
+++ b/config/squid3/33/swapstate_check.php
@@ -28,6 +28,7 @@
*/
require_once('config.inc');
require_once('util.inc');
+require_once('squid.inc');
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version > 2.0)
@@ -46,13 +47,12 @@ if ($settings['harddisk_cache_system'] != "null"){
$diskusedpct = round((($disktotal - $diskfree) / $disktotal) * 100);
$swapstate_size = filesize($swapstate);
$swapstate_pct = round(($swapstate_size / $disktotal) * 100);
-
// If the swap.state file is taking up more than 75% disk space,
// or the drive is 90% full and swap.state is larger than 1GB,
// kill it and initiate a rotate to write a fresh copy.
- if (($swapstate_pct > 75) || (($diskusedpct > 90) && ($swapstate_size > 1024*1024*1024))) {
- mwexec_bg("/bin/rm $swapstate; ". SQUID_LOCALBASE . "/sbin/squid -k rotate");
- log_error(gettext(sprintf("Squid swap.state file exceeded size limits. Removing and rotating. File was %d bytes, %d%% of total disk space.", $swapstate_size, $swapstate_pct)));
+ if (($swapstate_pct > 75) || (($diskusedpct > 90) && ($swapstate_size > 1024*1024*1024)) || $argv[1]=="clean") {
+ squid_dash_z('clean');
+ log_error(gettext(sprintf("Squid cache and/or swap.state exceeded size limits. Removing and rotating. File was %d bytes, %d%% of total disk space.", $swapstate_size, $swapstate_pct)));
}
}
?> \ No newline at end of file