Is there a way to see if there are any errors when crontab
job is executed?
I purposely added a command that returns error so I can check if I'm able to see the error.
*/1 * * * * cd /home/dirthatdoesnotexist && echo "RUNNING" > /tmp/cronlog.log 2>&1
When I call it manually:
milano@milano-desktop:~$ cd /home/dirthatdoesnotexist && echo "RUNNING"
bash: cd: /home/dirthatdoesnotexist: No such file or directory
It returns error as the directory doesn't exist.
But I can't see the error when it's called by CRON
.
I checked /tmp/cronlog.log
which does not exist.
I also checked /var/log/syslog
which says that the command has been executed, but it doesn't show the error.
milano@milano-desktop:~$ tail /var/log/syslog
Dec 7 20:12:01 milano-desktop CRON[64936]: (milano) CMD (cd /home/dirthatdoesnotexist && echo "RUNNING" > /tmp/cronlog.log 2>&1)
Dec 7 20:12:01 milano-desktop CRON[64935]: (CRON) info (No MTA installed, discarding output)
Is there a place where the error is logged?
0 Answers