Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
21.7 Legacy Series
»
[Solved] Custom CRON job gets deleted on every reboot
« previous
next »
Print
Pages: [
1
]
Author
Topic: [Solved] Custom CRON job gets deleted on every reboot (Read 4021 times)
QuisaZaderak
Newbie
Posts: 16
Karma: 0
[Solved] Custom CRON job gets deleted on every reboot
«
on:
September 30, 2021, 09:15:48 am »
In addition to my DLS and slow LTE line, I have also been using a Starlink connection for a few weeks. With IPv4, this works as desired.
IPv6 also works with the DSL provider and the LTE provider (unfortunately, you only get a 64 prefix with the DSL provider and no prefix at all with LTE, so not reasonably usable with multiple network segments).
Starlink IPv6 has a 56 prefix. However, the IPv6 connection always drops after a few minutes, so a regular call to /sbin/rtsol is necessary. Unfortunately, this can't seem to be set via System -> Cron in the GUI. Also I did not find a configuration option at the interface directly to accomplish this. So a custom CRON job entry via shell is necessary.
Therefore I log in directly to the OPNSense shell and edit the CRON jobs with CRONTAB -e. For this I add like the other existing lines the new line "*/2 * * * (/sbin/rtsol igb7) > /dev/null" and save with :wq. After that everything works as desired. Until the next reboot of OPNSense. This entry is deleted every time, no matter if it is in the middle or as the last line. I must edit it every time after reboot again with CRONTAB -e.
Since Maltrail currently has the memory bug and the regular restart of the Maltrail sensor alone does not always help, it is currently more frequent reboots, which is then of course even more annoying.
How can I make this custom cron job permanent so that it survives a reboot (and maybe even shows up in the GUI under CRON)?
«
Last Edit: October 01, 2021, 07:14:55 am by QuisaZaderak
»
Logged
Greelan
Hero Member
Posts: 1028
Karma: 72
Re: Custom CRON job gets deleted on every reboot
«
Reply #1 on:
September 30, 2021, 09:59:24 am »
Here’s a guide to adding a custom cron job that will stick and will be accessible to configure in the GUI:
http://kb.unixservertech.com/other/networking/opnsense/cron-jobs
The description field in the action conf will show up in the GUI (the message field shows in the log)
Logged
chemlud
Hero Member
Posts: 2483
Karma: 112
Re: Custom CRON job gets deleted on every reboot
«
Reply #2 on:
September 30, 2021, 10:01:21 am »
...or here
https://forum.opnsense.org/index.php?topic=10740.msg49334#msg49334
;-)
Logged
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare
felix eichhorns premium katzenfutter mit der extraportion energie
A router is not a switch - A router is not a switch - A router is not a switch - A rou....
Greelan
Hero Member
Posts: 1028
Karma: 72
Re: Custom CRON job gets deleted on every reboot
«
Reply #3 on:
September 30, 2021, 10:04:50 am »
You could also investigate using monit for this. It could monitor whether IPv6 is up and reload as needed
Logged
Greelan
Hero Member
Posts: 1028
Karma: 72
Re: Custom CRON job gets deleted on every reboot
«
Reply #4 on:
September 30, 2021, 10:11:51 am »
Here’s a specific cron job example for checking a WAN connection:
https://forum.opnsense.org/index.php?topic=18865.msg86224#msg86224
Shouldn’t be hard to adapt for IPv6
Logged
QuisaZaderak
Newbie
Posts: 16
Karma: 0
Re: [Solved] Custom CRON job gets deleted on every reboot
«
Reply #5 on:
October 01, 2021, 07:16:21 am »
I created a custom configd action like recommended. And it works. Thank you for your fast replies.
https://docs.opnsense.org/development/backend/configd.html
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
21.7 Legacy Series
»
[Solved] Custom CRON job gets deleted on every reboot