Skip to content

Commit 475352e

Browse files
author
Till Brehm
committed
Fixed #4252 added log levels to cron messages.
1 parent 58f4deb commit 475352e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

server/cron.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
$pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock'));
3838
if(preg_match('/^[0-9]+$/', $pid)) {
3939
if(file_exists('/proc/' . $pid)) {
40-
print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n";
40+
if($conf['log_priority'] <= LOGLEVEL_WARN) print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n";
4141
exit;
4242
}
4343
}
44-
print @date('d.m.Y-H:i').' - WARNING - There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.' . "\n";
44+
if($conf['log_priority'] <= LOGLEVEL_WARN) print @date('d.m.Y-H:i').' - WARNING - There is already a lockfile set, but no process running with this pid (' . $pid . '). Continuing.' . "\n";
4545
}
4646

4747
// Set Lockfile
@@ -90,15 +90,15 @@
9090
if(class_exists($class_name, false)) {
9191
$cronjob = new $class_name();
9292
if(get_parent_class($cronjob) !== 'cronjob') {
93-
print 'Invalid class ' . $class_name . ' not extending class cronjob (' . get_parent_class($cronjob) . ')!' . "\n";
93+
if($conf['log_priority'] <= LOGLEVEL_WARN) print 'Invalid class ' . $class_name . ' not extending class cronjob (' . get_parent_class($cronjob) . ')!' . "\n";
9494
unset($cronjob);
9595
continue;
9696
}
97-
print 'Included ' . $class_name . ' from ' . $path . '/' . $f . ' -> will now run job.' . "\n";
97+
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'Included ' . $class_name . ' from ' . $path . '/' . $f . ' -> will now run job.' . "\n";
9898

9999
$cronjob->run();
100100

101-
print 'run job (' . $class_name . ') done.' . "\n";
101+
if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'run job (' . $class_name . ') done.' . "\n";
102102

103103
unset($cronjob);
104104
}
@@ -109,6 +109,6 @@
109109
@unlink($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock');
110110
$app->log('Remove Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock', LOGLEVEL_DEBUG);
111111

112-
die("finished.\n");
112+
if($conf['log_priority'] <= LOGLEVEL_DEBUG) die("finished.\n");
113113

114114
?>

0 commit comments

Comments
 (0)