OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • crontab resetting after reboot
« previous next »
  • Print
Pages: [1]

Author Topic: crontab resetting after reboot  (Read 7640 times)

tortellini

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
crontab resetting after reboot
« on: April 12, 2016, 02:29:29 am »
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.
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: crontab resetting after reboot
« Reply #1 on: April 12, 2016, 09:01:48 am »
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.
Logged

sstreiner

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: crontab resetting after reboot
« Reply #2 on: July 31, 2016, 07:08:31 pm »
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
Logged

AdSchellevis

  • Administrator
  • Hero Member
  • *****
  • Posts: 907
  • Karma: 184
    • View Profile
Re: crontab resetting after reboot
« Reply #3 on: July 31, 2016, 07:40:20 pm »
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
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: crontab resetting after reboot
« Reply #4 on: August 01, 2016, 09:29:34 am »
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
Logged

interkrome

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 3
    • View Profile
Re: crontab resetting after reboot
« Reply #5 on: August 11, 2016, 08:57:06 am »
Seems like almost identical with my case :

https://forum.opnsense.org/index.php?topic=3511.0
Logged

tillsense

  • Sr. Member
  • ****
  • Posts: 325
  • Karma: 49
    • View Profile
Re: crontab resetting after reboot
« Reply #6 on: August 18, 2016, 07:17:29 pm »
read too late. (Update 16.7.2) I have added under the roadmap ideas.
https://forum.opnsense.org/index.php?topic=3516.0
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • crontab resetting after reboot
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2