Added master script crash timeout
This commit is contained in:
parent
74324914c2
commit
e3230de8c2
|
@ -41,6 +41,7 @@ INSERT INTO `config` (`conf`, `category`, `type`, `label`, `description`, `value
|
|||
('dbclean.enabled', 'Database Cleanup', 'text', 'Enabled', 'Database cleanup enabled? (true: yes; false: no)', 'false'),
|
||||
('dbclean.lastrun', 'Database Cleanup', 'hidden', 'Last run', 'Last run of database cleanup', UNIX_TIMESTAMP()),
|
||||
('jobs.reboottime', 'Jobs', 'number(0,30)', 'Reboot delay', 'The amount of delay in minutes between scheduling a reboot and the actual reboot', '5');
|
||||
('master.crashtimeout', 'Master script', 'number()', 'Master script crash timeout', 'The amount of time in seconds after we can assume the master script is crashed', '3600');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
|
|
@ -26,11 +26,12 @@
|
|||
|
||||
require_once "include/initialize.inc.php";
|
||||
|
||||
if(file_exists('/tmp/webcron.lock'))
|
||||
if(file_exists('/tmp/webcron.lock') && file_get_contents('/tmp/webcron.lock') + 0 < time() - get_configvalue('master.crashtimeout'))
|
||||
{
|
||||
die('Script is already running');
|
||||
}
|
||||
touch('/tmp/webcron.lock');
|
||||
unlink('/tmp/webcron.lock');
|
||||
file_put_contents('/tmp/webcron.lock', time());
|
||||
|
||||
/**
|
||||
* Reboot finalize
|
||||
|
|
Loading…
Reference in New Issue