I have a cronjob that has to be run every minute. And every minute cron add a new line into syslog about that. How can I suppress this behavior?
3 Answers
First, backup syslog.conf
:
sudo cp /etc/syslog.conf /etc/syslog.conf.backup
Then, open up syslog.conf
in your editor of choice, and change this:
*.*;auth,authpriv.none -/var/log/syslog
to this:
*.*;auth,authpriv.none,cron.none -/var/log/syslog
although the caveat is that you cannot check if your job is running.
-
1I've also uncommented
cron.* /var/log/cron.log
so I can check if my job is running :)– vavaCommented Sep 14, 2009 at 4:54
redirect standard output into /dev/null, while if you going get an error you'll receive an email about it:
shell.script.sh > /dev/null 2>&1
-
2It's not the job itself that floods but cron just notifies that it did run it– vavaCommented Sep 14, 2009 at 4:51
For rsyslog, you can filter messages like this:
:msg, startswith, "(your-login) CMD (command" ~
in the /etc/rsyslog.conf file. Take notice the tilde at the end.