From 4fd0a6eeab5041ce29e72c4b893c0d9bcfe52e88 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 10 Sep 2023 06:29:34 -0700 Subject: [PATCH] Start to add some logging to cron.php. --- Rocksolid_Light/rslight/scripts/cron.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/cron.php b/Rocksolid_Light/rslight/scripts/cron.php index c65f2ad..333d4f3 100644 --- a/Rocksolid_Light/rslight/scripts/cron.php +++ b/Rocksolid_Light/rslight/scripts/cron.php @@ -5,10 +5,15 @@ include "newsportal.php"; include $config_dir . "/scripts/rslight-lib.php"; include $config_dir . "/gpg.conf"; +$pid = getmypid(); +$logfile = $logdir . '/cron.log'; if (file_exists($config_dir . '/cron.disable')) { - $logfile = $logdir . '/cron.log'; - file_put_contents($logfile, "\n" . date('M d H:i:s') . " " . $config_name . " cron.php disabled by semaphore: ".$config_dir . "/cron.disable Exiting...", FILE_APPEND); - exit; + file_put_contents($logfile, "\n" . date('M d H:i:s') . " " . $config_name . " cron.php disabled by semaphore: " . $config_dir . "/cron.disable Exiting...", FILE_APPEND); + chown($logfile, $CONFIG['webserver_user']); + exit(); +} else { + file_put_contents($logfile, "\n" . date('M d H:i:s') . " " . $config_name . " cron ".$pid." started...", FILE_APPEND); + chown($logfile, $CONFIG['webserver_user']); } $menulist = file($config_dir . "menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); @@ -128,6 +133,7 @@ echo "Log files rotated\n"; # Rotate keys rotate_keys(); echo "Keys rotated\n"; +file_put_contents($logfile, "\n" . date('M d H:i:s') . " " . $config_name . " cron ".$pid." completed...", FILE_APPEND); function log_rotate() {