I have the following job in my crontab:
0 */4 * * * /usr/bin/mysqldump -u root -p'PASSWORD' --all-databases | /bin/gzip -9 > /home/USER/_mysql_backup/`date "+\%F--\%H-\%M"`.databases.sql.gz ; rm -f /home/USER/_mysql_backup/`date '+\%F' --date '1 week ago'`.databases.sql.gz >/dev/null 2>&1
The problem is that it's filling up my syslog. I thought adding >/dev/null 2>&1
would prevent the job from being logged, but do I also need to add it for the previous command before the ;
?
rm -f [...]
to/dev/null
. What do you see in the log?CRON[22446]: (CRON) info (No MTA installed, discarding output)
CRON[22471]: (user) CMD (/usr/bin/mysqldump -u root -p'PASSWORD' --all-databases | /bin/gzip -9 > /home/USER/_mysql_backup/
date "+%F--%H-%M".databases.sql.gz ; rm -f /home/USER/_mysql_backup/
date '+%F' --date '1 week ago'.databases.sql.gz >/dev/null 2>&1)
cron
simply logs what it executes. Your question should read "how do I stop cron from logging executed commands?"