Prevent 2 instances of rc.prunecaptiveportal from running in parallell since this might be a bad thing

This commit is contained in:
Ermal 2012-05-23 12:54:51 +00:00
parent d535507a07
commit 6405333995

View File

@ -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");
?>