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.

2 Answers2

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!

xCanox
  • 61
  • 5
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

John Mahowald
  • 32,050
  • 2
  • 19
  • 34
  • 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 05:09