diff options
author | Ermal <eri@pfsense.org> | 2012-05-23 12:54:51 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2012-05-23 12:55:42 +0000 |
commit | 6405333995acc0107254f9d8a16ffc427097253f (patch) | |
tree | 4aff729170cb2af11fd7e0ab7f932de3983d70b2 /etc | |
parent | d535507a07810b5a7e739f6e92ac6710788abe53 (diff) | |
download | pfsense-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')
-rwxr-xr-x | etc/rc.prunecaptiveportal | 10 |
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"); ?> |