0

CentOS 6.4 is happy with this, but CentOS 7 tells me "errors in crontab file, can't install.". What's wrong with this crontab file (just the 2 lines)?

0 0 * * * /home/web/backup-db.sh
0 1 * * * /home/web/backup-files.sh

I've tried this based on this answer here, this doesn't work either:

every '0 0 * * *' do /home/web/backup-db.sh
every '0 1 * * *' do /home/web/backup-files.sh

It's not permissions on those files, because this doesn't work either:

1 1 * * * /usr/sbin/ntpdate -s time-1.ncsu.edu

ntupdate is correctly installed, and in that location. So it's something about my crontab syntax I think - ideas?

  • 1
    Please explain what you did when trying to install the file (also the every .... from the answer you linked is valid only in the context of that ruby script, it's not valid syntax for a crontab. – Sven Aug 12 '17 at 18:01
  • If you open in the crontab in vim and do :set list are there any unexpected hidden characters, like carriage-returns? – shearn89 Aug 14 '17 at 10:09
  • @Sven - good to know that that middle block is ruby. The other blocks I've tried I've just installed by saving the file - ie.., 'crontab -e' to edit crontab, save. I'm using emacs to edit the file. – user2044774 Aug 14 '17 at 17:19
  • @shearn89, No unexpected hidden characters. – user2044774 Aug 14 '17 at 17:19
0

If this is /etc/crontab, you're missing a username in there.

Try this:

0 0 * * * root /home/web/backup-db.sh
0 1 * * * root /home/web/backup-files.sh
  • I tried that, didn't work. – user2044774 Aug 13 '17 at 1:10
0

Adding a # on a single line at the end of the file fixed it. It was a premature EOF issue.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.