skip to Main Content

I am trying to set up a crontab job to back up a mysql DB every day at a specific time.
I do the following steps (as root):

  1. crontab -e
  2. 00 11 * * * root /root/my_Backups/productionbDB-backup.sh >> mybackup.log 2>&1
  3. service crond restart

I waited to be 11 am, but nothing happened.
I confirmed that if the command /root/my_Backups/productionbDB-backup.sh is issued from the command line, as root, it creates the backup.

What am I missing?

2

Answers


  1. 00 11 * * * root /root/my_Backups/productionbDB-backup.sh >> mybackup.log 2>&1 -> what is the root word doing there? What you should have is 00 11 * * * /root/my_Backups/productionbDB-backup.sh >> mybackup.log 2>&1

    Login or Signup to reply.
  2. You have used the format for installing crontabs into system wide /etc/cron.d/

    <time spec> <user> <command>

    As you are installing into a users personal crontab (for example on CentOS /var/spool/cron/{user}) using crontab -e the format ommits the user specification

    <time spec> <command>

    More information available in the cron manpage here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search