summaryrefslogtreecommitdiffstats
path: root/etc/rc.prunecaptiveportal
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-05-23 12:54:51 +0000
committerErmal <eri@pfsense.org>2012-05-23 12:55:42 +0000
commit6405333995acc0107254f9d8a16ffc427097253f (patch)
tree4aff729170cb2af11fd7e0ab7f932de3983d70b2 /etc/rc.prunecaptiveportal
parentd535507a07810b5a7e739f6e92ac6710788abe53 (diff)
downloadpfsense-6405333995acc0107254f9d8a16ffc427097253f.zip
pfsense-6405333995acc0107254f9d8a16ffc427097253f.tar.gz
Prevent 2 instances of rc.prunecaptiveportal from running in parallell since this might be a bad thing
Diffstat (limited to 'etc/rc.prunecaptiveportal')
-rwxr-xr-xetc/rc.prunecaptiveportal10
1 files changed, 10 insertions, 0 deletions
diff --git a/etc/rc.prunecaptiveportal b/etc/rc.prunecaptiveportal
index ee6c943..3a8620f 100755
--- a/etc/rc.prunecaptiveportal
+++ b/etc/rc.prunecaptiveportal
@@ -38,7 +38,17 @@ require_once("filter.inc");
require_once("shaper.inc");
require_once("captiveportal.inc");
+global $g;
+
$cpzone = str_replace("\n", "", $argv[1]);
+
+if (file_exists("{$g['tmp_path']}/.rc.prunecaptiveportal.{$cpzone}.running")) {
+ log_error("Skipping CP prunning process because previous/another instance is already running");
+ return;
+}
+
+@file_put_contents("{$g['tmp_path']}/.rc.prunecaptiveportal.{$cpzone}.running", "");
captiveportal_prune_old();
+@unlink("{$g['tmp_path']}/.rc.prunecaptiveportal.{$cpzone}.running");
?>
OpenPOWER on IntegriCloud