vanishing cron jobs

Status
Not open for further replies.

Ian Bennett

Dabbler
Joined
Jun 10, 2016
Messages
11
Using FreeNAS 9.10. I have a file cronfile with a single cron task which I register by running crontab cronfile from a terminal logged on as root. All goes well and a crontab -l shows the job registers just fine. It's a daily job and it runs perfectly... for a while. Out of nowhere, the job appears to simply vanish - running crontab -l shows an empty list! This has happened twice now in around a year.

Re-registering using crontab cronfile puts everything back in order and things are OK once more, but it's recently happened again. Anyone any idea why this might be the case? Am I missing something? Perhaps some background job that FreeNAS runs periodically (say every 6 months) is clobbering my manually registered cron task. Maybe I should use the GUI to set up cron rather than a manual crontab cronfile from a terminal.

If anyone can point me in the correct direction it would be much appreciated.
 
Last edited by a moderator:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Maybe I should use the GUI to set up cron rather than a manual 'crontab cronfile' from a terminal.
Yes, I'd say so--this is the most likely source of what you're seeing. Especially if you're changing anything in the GUI around the time the cron job disappears.
 

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
It's important to remember that FreeNAS is an appliance. Many of the normal Unix settings are kept in a database. Making manual changes to configuration files can be overwritten exactly as described.

Maybe I should use the GUI to set up cron rather than a manual 'crontab cronfile' from a terminal.
Yes.
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
Indeed. crontabs (on the appliance) are stored in the database. Any manual changes you make, at the CLI (instead of the GUI), will certainly die at any reboot/restart, and possibly sooner. If you want to add something to cron, you add it to the database, by adding it to the appropriate place in the GUI.

Of course, in a *JAIL*, that is not the case, and you would treat a jail as you would bare metal running FreeBSD, and thus, make your changes to the crontab in there manually.
 
Status
Not open for further replies.
Top