Skip to content

Commit b26653b

Browse files
author
Marius Cramer
committed
Corrected bug in cron job logging and added wget output log (only of last job)
1 parent d58816c commit b26653b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

server/plugins-available/cron_plugin.inc.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,19 @@ function _write_crontab() {
203203
}
204204

205205
$log_target = ">/dev/null 2>&1";
206+
$log_wget_target = '/dev/null';
207+
$log_root = '';
206208
if($job['log'] == 'y') {
207-
$log_root = '';
208-
if($job['type'] != 'chrooted') $log_root = $this->parent_domain['document_root'] . '/log';
209+
if($job['type'] != 'chrooted') $log_root = $this->parent_domain['document_root'];
210+
$log_root .= '/log';
209211

210-
$log_target = '>' . $log_root . '/cron.log 2>' . $log_root . '/cron_error.log';
212+
$log_target = '>>' . $log_root . '/cron.log 2>>' . $log_root . '/cron_error.log';
213+
$log_wget_target = $log_root . '/cron_wget.log';
211214
}
212215

213216
$command .= "\t{$this->parent_domain['system_user']}"; //* running as user
214217
if($job['type'] == 'url') {
215-
$command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O /dev/null " . escapeshellarg($job['command']) . " " . $log_target;
218+
$command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O " . $log_wget_target . " " . escapeshellarg($job['command']) . " " . $log_target;
216219
} else {
217220
$web_root = '';
218221
if($job['type'] == 'chrooted') {

0 commit comments

Comments
 (0)