crontab resetting after reboot

Started by tortellini, April 12, 2016, 02:29:29 AM

Previous topic - Next topic
Hi, every time the server reboots; the crontab resets. How can we save cronjobs during reboots?
Using 16.1.9. Not sure if always an issue; but, using for past few months.

We're planning to open up the cron GUI for 16.7, but have no ETA at the moment other than "ready in July". The reset behaviour is intended.

Hi guys! I'd also like to have some cronjobs :)
Using 16.7 gives me a cronjob ui, but unfortunately there is no "custom command" option.
I can only use predefined commands.

Bug? Works as desired? Workarounds?

Cheers,
Sam

Hi Sam,

Works as intended.
You need to define configd commands first, which can automatically be registered for use in cron.

See https://docs.opnsense.org/development/backend/configd.html?highlight=configd for information how to register new commands.

Don't forget to add a description, only commands with a description are shown by cron (for example see this commit which exposes the alias update to cron https://github.com/opnsense/core/commit/c0a724a922f1393902f64929a9b90a5e443783ec#diff-e7a381bb88c962fd620afd853b662f52).

Best regards,

Ad

Ok, this is a bit tricky...

/var/cron/tabs/root -- autogenerated by OPNsense, harbours the old *sense cron jobs
/var/cron/tabs/nobody -- autogenerated by OPNsense, harbours the privilege-separated cron jobs

The Cron GUI updates the latter, so simply running custom commands will likely not work because they'd require more privileges.

We, however, do not touch /etc/crontab anymore. The only problem is that it gets rewritten on FreeBSD userland updates to keep its commands in sync with the rest of the system.

The long-term solution is porting all remaining jobs from /var/cron/tabs/root to /var/cron/tabs/nobody, freeing the former for manual usage.

The short or mid-term solutions are talking about what kind of jobs you think about running and seeing if we (a) already have them under the hood and only need to plant them in the GUI or (b) provide the commands via the backend system.


Cheers,
Franco


read too late. (Update 16.7.2) I have added under the roadmap ideas.
https://forum.opnsense.org/index.php?topic=3516.0