I have a cron job that is supposed to execute a bash script. I have confirmed the bash script does work as the cron job works properly on my local machine.
However the cron job does not appear to be firing on a remote machine that I have access to. As a test I am doing a touch command. My cron job is as follows:
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
21 12 * * * /usr/bin/touch /home/aidan/test.txt
This cron job should create a test.txt file in "/usr/bin/touch". However, it appears that it is not firing at all.
To debug I have looked at "/var/log/syslog" using the following 2 commands:
- sudo cat /var/log/syslog | grep -w 'cron' In this command I am getting the following output:
Dec 13 20:21:01 onecup cron[1628]: (aidan) RELOAD (crontabs/aidan)
- sudo grep CRON /var/log/syslog. In this command I am getting the following output:
Dec 13 17:17:01 onecup CRON[1060280]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Dec 13 18:17:01 onecup CRON[1120928]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Dec 13 19:17:01 onecup CRON[1180117]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Dec 13 20:17:01 onecup CRON[1238901]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Notice, that in this command the cron job does not appear at all.
My expectation is that the CMD should appear.
In short it appears the cronjob is reloading but never actually firing. Does anyone have any ideas?
Also, note I did see this here: https://stackoverflow.com/questions/60842683/cron-not-running-tasks-ubuntu-18-04.
It did not fix the issue.
cron.hourly
log entries around your crontab entry's 12:21 timespec (noDec 13 12:17:01
orDec 13 13:17:01
for example)