Hello,
I'm trying to add custom commands at boot (this is not a service or daemon!) to run at every boot, it just needs to cd to a directory and rename a file. nothing else.
I tried to follow the freeBSD documentation which says to put the .sh file containing the command in /usr/local/etc/rc.d/ which is completey ignored it seems, even if I enable rc_debug it logs nothing.
If I change the crontab using @reboot it's deleted by opnsense at every boot.
What should I do?
Take a look at these docs:
https://docs.opnsense.org/development/backend/autorun.html
https://docs.opnsense.org/development/backend/configd.html
Cheers,
Franco
Quote from: franco on September 12, 2018, 03:06:14 PM
Take a look at these docs:
https://docs.opnsense.org/development/backend/autorun.html
https://docs.opnsense.org/development/backend/configd.html
Cheers,
Franco
Hello,
thanks! The first solution looks like the one I'm looking for.
Just two things:
1) the docs show a directory system like "/usr/local/etc/rc.syshook.d/early/50-yourscript"
On my build I don't have any subdirectory, just files like 20-freebsd.start . Is it because I'm using and old version (18.1)?
2) I tried both version anyway and nothing seems to work, maybe I'm missing something. Is there a way to debug this?
My script is a simple test like this
#!/bin/bash
touch /home/hotspotuser/testfile
I don't see why it shouldn't work
Nevermind, the 50-myscript.start worked! :D
Hi sandro87,
You are using a version < 18.7 I think. The docs reflect the reality in 18.7, but scripts are automatically migrated on update so it'll keep working.
Cheers,
Franco