function cron_track_running($mode) { @define('CRON_STARTMARK', TRIGGERS_DIR . 'cron_started_at_' . date('Y-m-d_H-i-s') . '_by_pid_' . getmypid()); if ($mode == 'start') { cron_touch_lock_file(CRON_RUNNING); file_write('', CRON_STARTMARK); } elseif ($mode == 'end') { @unlink(CRON_STARTMARK); } }
function cron_release_file_lock() { $lock_released = @rename(CRON_RUNNING, CRON_ALLOWED); cron_touch_lock_file(CRON_ALLOWED); }