4

I have added the following crontab job:

sudo crontab -e

enter image description here

58 * * * * ubuntu /home/ubuntu/backup/mysqlbackup.sh
>/home/ubuntu/backup/log/backup.log

I have tried both root and ubuntu users.

When I run the command:

sudo crontab -l

enter image description here

And when I run:

systemctl status cron

enter image description here

But mysqlbackup.sh is not executed. Any idea what is the problem or how can I diagnose what is going wrong?


Note I have added only minutes to test the script

Hooman Bahreini
  • 518
  • 1
  • 8
  • 24

1 Answers1

9
58 * * * * ubuntu /home/ubuntu/backup/mysqlbackup.sh >/home/ubuntu/backup/log/backup.log

This is incorrect format.

The format is described in the crontab file:

  # m h  dom mon dow   command

ubuntu is not a command. Remove it, so the line reads:

  58 * * * *  /home/ubuntu/backup/mysqlbackup.sh >/home/ubuntu/backup/log/backup.log

Systemwide crontab, specified in /etc/crontab has the user field:

These files also have username fields,
# that none of the other crontabs do.
[...]
# m h dom mon dow user  command
vidarlo
  • 23,497