-2

I recently made some changes to my crontab, added some new entries and activated one disabled (commented) entry. However, the new changes that I made were not triggered and the crontab functioned as it was in the previous state, although the crontab shows the changes made to it.

One more thing, i also edited the crontab file of root user in my "/var/spool/cron" folder. I think it has something to do with it.

1

To edit a crontab file, always use crontab -e. If you want to edit the crontab of the root user, use sudo crontab -e.

Changing the files under the crontab spool directory is definitely not advised. Editing via crontab -e additionally informs the cron daemon that the crontab needs to be re-read. This may not otherwise happen.

Related:

  • So now what do I have do? I should also mention that I edited the crontab with "crontab -e" afterwards. Will this be enough for the changes to take effect? – Faisal Abbas Dec 10 '18 at 8:45
  • @FaisalAbbas Editing the crontab with crontab -e will ensure that the changes take effect. If you have any errors in the crontab, then this may cause the jobs to fail (and an error message to be emailed to the owner of the crontab), but you never showed what your crontab looked like so I couldn't really comment on that. – Kusalananda Dec 10 '18 at 8:48
  • I edited the crontab with "crontab -e" and the job worked well. Thanks! – Faisal Abbas Dec 10 '18 at 8:50

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.