OPNsense Forum

Archive => 20.1 Legacy Series => Topic started by: unixpgmr on March 06, 2020, 09:03:47 PM

Title: user defined cron jobs to survive reboot
Post by: unixpgmr on March 06, 2020, 09:03:47 PM
I created some custom scripts to monitor things such as who logs in, load average, temps, etc.  I set these up so they would send a warning to my discord server.  These scripts required root privs, so added them to the root crontab. They didn't survive a reboot.  Is there a way to add custom cron jobs that will survive a reboot or upgrade?  I know that we have nrpe plugin, but I don't want to have another server just to receive nrpe notifications.  This works without the headache or cost of another server running.
Title: Re: user defined cron jobs to survive reboot
Post by: franco on March 08, 2020, 08:49:33 AM
Hi,

Have a look at:

https://docs.opnsense.org/development/backend/configd.html

Of particular note is adding a "description" field which allows your custom actions to be added to the GUI under System: Settings: Cron where you can use it as required.


Cheers,
Franco
Title: Re: user defined cron jobs to survive reboot
Post by: unixpgmr on March 09, 2020, 08:03:16 PM
Thanks much. I will look at that. It didn't occur to me to use configd for custom cron scripts.
Title: Re: user defined cron jobs to survive reboot
Post by: Michel89 on March 10, 2020, 12:52:50 AM
You may also define your cron jobs in "/etc/cron.d/crontab".