0

I wonder why my cron job didn't work. Our team consider that the cron job didn't work because we didn't properly update the crontab file. Following is the process what we did:

  1. Backup the current cron jobs.

    cd /var/spool/spool/cron/crontabs
    cp -p jeus jeus.20170120
    
  2. Remove all the cron jobs for the user, whose name is jeus.

    crontab -r
    
  3. Make sure if all the cron jobs are removed.

    crontab -l
    
  4. After about 12 hours, we recover it like this.

    cd /var/spool/spool/cron/crontabs
    cp -p jeus.20170120 jeus
    

We think that our cron jobs didn't work because we didn't update the crontab file like the following commands. We just recovered the file we saved before.

    1. Open (crontab -e)
    2. Save (:wq)

Do you think our idea is reasonable? Do you have any ideas on the issue we had experience?

(Update) The problem is that cron jobs weren't executed at all.

  • What does "didn't work" mean, did they not execute or is there an error mail? – John Mahowald Jan 23 '17 at 3:59
  • @JohnMahowald It didn't execute at all. – Sung Am YANG Jan 23 '17 at 5:07
1

Try login with user jeus.

cat jeus.20170120

crontab -e

press i (Insert mode) paste the content of cat jeus.20170120 press esc then :wq!

0

It is not clear how your job failed. Check for error email. Run the command outside of cron to be sure it functions. Check the schedule syntax, there's plenty of crontab generators online.

crontab -l > file would save a copy of the existing crontab, which could be restored with crontab file

  • The cron jobs weren't executed at all. Also ,the content in the crontab file has been used for over a couple of years. Therefore, I don't think there are some syntax errors. – Sung Am YANG Jan 23 '17 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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