summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-05-23 12:53:37 +0000
committerErmal <eri@pfsense.org>2012-05-23 12:53:37 +0000
commit3807002ce5ae75b75bd81df64ff5d26af7b338a4 (patch)
tree6dcf72c55c415290a30e160c617df5c3df04a6df /etc
parent6b517c763fec48af1dc60f78881e772c058b85b4 (diff)
downloadpfsense-3807002ce5ae75b75bd81df64ff5d26af7b338a4.zip
pfsense-3807002ce5ae75b75bd81df64ff5d26af7b338a4.tar.gz
Prevent 2 instances of rc.prunecaptiveportal from running in parallell since this might be a bad thing
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.prunecaptiveportal9
1 files changed, 9 insertions, 0 deletions
diff --git a/etc/rc.prunecaptiveportal b/etc/rc.prunecaptiveportal
index 798b196..346ed41 100755
--- a/etc/rc.prunecaptiveportal
+++ b/etc/rc.prunecaptiveportal
@@ -38,6 +38,15 @@ require_once("filter.inc");
require_once("shaper.inc");
require_once("captiveportal.inc");
+global $g;
+
+if (file_exists("{$g['tmp_path']}/.rc.prunecaptiveportal.running")) {
+ log_error("Skipping CP prunning process because previous/another instance is already running");
+ return;
+}
+
+@file_put_contents("{$g['tmp_path']}/.rc.prunecaptiveportal.running", "");
captiveportal_prune_old();
+@unlink("{$g['tmp_path']}/.rc.prunecaptiveportal.running");
?>
OpenPOWER on IntegriCloud