Skip to content

Commit

Permalink
redirect cron output to logfile and add said logfile to logrotation
Browse files Browse the repository at this point in the history
  • Loading branch information
0x616469 committed Feb 28, 2012
1 parent f62bad9 commit 8f2fa7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions debian_templates/logrotate
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@
fi
endscript
}

/var/log/sitelogs/_-_PACKAGENAME_-_/cron.log {
daily
missingok
rotate 30
compress
delaycompress
create 640 www-data adm
}
2 changes: 1 addition & 1 deletion lib/Liip/Symfony2/Application.pm
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ sub make_cron {
foreach my $command (keys %{$self->{cron}}) {
$scheduling = $self->{cron}->{$command};
my $wwwroot = $self->{helper}->safe_wwwroot($self->{name}, 1);
$cron_data.= "$scheduling www-data cd $wwwroot && php app/$self->{name}/console $command\n";
$cron_data.= "$scheduling www-data cd $wwwroot && php app/$self->{name}/console $command >> /var/log/sitelogs/$self->{destination}/cron.log 2>&1\n";
}
write_file("$self->{destprefix}.cron.d", $cron_data);
}
Expand Down

0 comments on commit 8f2fa7d

Please sign in to comment.