CRON

Getting cron jobs to stop writing syslog and save to cron.log on Debian squeeze.

Edit /etc/syslog.conf and change these two lines:

*.*;auth,authpriv.none      -/var/log/syslog
#cron.*	 		    -/var/log/cron.log

to

*.*;cron,auth,authpriv.none     -/var/log/syslog
cron.*			        -/var/log/cron.log

Restart syslog:

/etc/init.d/sysklogd restart

Change /etc/cron.daily/sysklogd to stop syslog processing for cron:

logs=$(syslogd-listfiles)

to:

logs=$(syslogd-listfiles -s cron\*)

Change /etc/cron.weekly/sysklogd to stop syslog processing for cron:

logs=$(syslogd-listfiles --weekly)

to:

logs=$(syslogd-listfiles --weekly -s cron\*)

Create/edit /etc/logrotate.d/cron

# /etc/logrotate.d/cron
 /var/log/cron {
    sharedscripts
    postrotate
    daily
    missingok
    /etc/init.d/sysklogd reload
    endscript
}

Finally reload the syslog configuration which will include the new logrotate.d cron.

/etc/init.d/sysklogd reload

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Our weather forecast is from WP Wunderground