Cron is a Linux utility that schedules a command or script on your server to run automatically at a specified time and date. As the name implies a cron “job” is a scheduled job. Cron jobs can be very useful to automate almost any task in Linux.
While adding a cronjob is quite easy (just use crontab -e), but more on that in another post, getting them to work properly can sometimes be an enigma. That is why checking if your cron has run as it should is important and also quite easy.
After logging into your server and escalating to root user just type:
grep “slurpramen.py” /var/log/cron
This will search the log files in order to display the cron results if any.
- If your cron has run properly, after hitting Enter you should see something similar to:
Jun 25 05:33:02 slurpramen crond: (slurpramen) CMD (sudo xvfb-run /home/pi/python3 slurpramen.py) Jun 25 07:33:01 slurpramen crond: (slurpramen) CMD (sudo xvfb-run /home/pi/python3 slurpramen.py) Jun 25 09:33:01 slurpramen crond: (slurpramen) CMD (sudo xvfb-run /home/pi/python3 slurpramen.py)
The output will thus show you the date, hour and what script it ran is the return is empty, you better check your cron jobs with
to see if they are listed.