use the same cron.d-name as in the config-template as the 'default' cronjob is not needed after the first generation of the new one; generate different lockfiles for the different jobs to avoid unnecessary conflicts

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2014-01-23 13:59:09 +01:00
parent 6d1899d72e
commit 019da862dd
7 changed files with 19 additions and 8 deletions

View File

@@ -31,8 +31,19 @@ if (function_exists("date_default_timezone_set")
@date_default_timezone_set(@date_default_timezone_get());
}
$basename = basename($_SERVER['PHP_SELF'], '.php');
if (isset($argv) && is_array($argv) && count($argv) > 1) {
for($x=1;$x < count($argv);$x++) {
if (substr(strtolower($argv[$x]), 0, 2) == '--'
&& strlen($argv[$x]) > 3
) {
$basename .= "-".substr(strtolower($argv[$x]), 2);
break;
}
}
}
$lockdir = '/var/run/';
$lockFilename = 'froxlor_' . basename($_SERVER['PHP_SELF'], '.php') . '.lock-';
$lockFilename = 'froxlor_' . $basename . '.lock-';
$lockfName = $lockFilename . getmypid();
$lockfile = $lockdir . $lockfName;