Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
General Discussion
»
Recommended place for user created shell scripts?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Recommended place for user created shell scripts? (Read 2270 times)
Patrick M. Hausen
Hero Member
Posts: 6845
Karma: 575
Recommended place for user created shell scripts?
«
on:
July 24, 2020, 08:31:56 am »
Hi all,
if I want to set up some custom cron jobs, is there an official recommendation where to put them?
My main concern is that I want them to survive a firmware upgrade, of course.
Thanks,
Patrick
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
franco
Administrator
Hero Member
Posts: 17668
Karma: 1611
Re: Recommended place for user created shell scripts?
«
Reply #1 on:
July 24, 2020, 09:03:07 am »
Hi Patrick,
Add your scripts somewhere and register actions for them like so:
https://docs.opnsense.org/development/backend/configd.html
When you use a "description" these actions (your scripts) will show up in the System: Settings: Cron GUI for use.
Cheers,
Franco
Logged
Patrick M. Hausen
Hero Member
Posts: 6845
Karma: 575
Re: Recommended place for user created shell scripts?
«
Reply #2 on:
July 24, 2020, 09:49:30 am »
Hi Franco,
I don't need UI access. It's only cron jobs. I just wanted to be sure the next upgrade won't wipe e.g. /usr/local/sbin/myscript.sh or similar.
I guess placing them into /home somewhere will do.
Thanks,
Patrick
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
Patrick M. Hausen
Hero Member
Posts: 6845
Karma: 575
Re: Recommended place for user created shell scripts?
«
Reply #3 on:
July 24, 2020, 10:34:22 am »
Ah ... now I get it. I assumed that System --> Settings --> Cron would let you specify arbitrary commands.
Seems like it doesn't.
Thanks again
Patrick
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
franco
Administrator
Hero Member
Posts: 17668
Karma: 1611
Re: Recommended place for user created shell scripts?
«
Reply #4 on:
July 24, 2020, 01:03:21 pm »
You can't manipulate cron without a defined backend action. Config files will revert defaults otherwise. That's why this is a bit more work initially, but can be automated as a plugin package if mass deployment is relevant.
We generally avoid the ability to tie custom scripts to working code directly, especially through config.xml.
Separate files and scripts are never touched by the system unless the file name appears in the packages at some point in time. Just make sure to create a separate directory that is unlikely to ever appear (i.e. /usr/local/mycoolscripts)
Cheers,
Franco
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
General Discussion
»
Recommended place for user created shell scripts?