1

Cronjob was working for couple of months, until something mysteriously happened and then it stopped. I checked under the user and under the root, and couldnt find any cronjobs. However what I am really interested in, when I first started cronjob with sudo crontab -e, file that was opened had lots of comments in it. Also each time I would hit that command, same file with all cronjobs would be opened for me. Now when I run it each time I get open different blank file:

/tmp/crontab.Tpv8X6/crontab
/tmp/crontab.fckvR2/crontab 
etc. 

Why is this happening? I would like to be able to open same file all over again.

  • What editor are you using to edit the file, and how are you exiting from it? it sounds like the temporary file isn't getting written to the spool area when you're done editing it. – steeldriver Nov 10 '16 at 0:01
1

These are temporary files created whilst crontab -e is invoked (i.e. while your editor is still open). Actual user crontabs are kept in:

/var/spool/cron/crontabs

So you can check there for crontabs you expect to exist. However these files are not supposed to be edited directly, you should continue to use crontab -e to edit/update your cron jobs. Alternatively you can edit the global crontab at:

/etc/crontab

which has an extra 'user' field for you to specify the user under which the command should be run.

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.