Shell scripts at /usr/local/etc/rc.d - when will they be executed?
-
This section of the pfSense Docs says:
Any shell script can be placed in the
/usr/local/etc/rc.d/
directory. The firewall will execute every shell script ending in .sh in this directory at boot time and also during certain system events (e.g. interface link changes, IP address changes, and gateway events).Is it documented somewhere exactly which system events these are, and what scripts will be triggered?
-
I use a manually added FreeBSD package, 'munin' that came with a file to be placed in /usr/local/etc/rc.d/
As per pfSense needs, I renamed it - added the .sh extension, and now the munin process get started at boot, and stopped at shutdown.
I made this install many years ago, and as far as I know, the script only executes during boot and system shutdown.
Not for network or other events etc.If FreeBSD would look like a Debian system (or clone) using init or systemd I could tell you way more, and I even think pfSEnse isn'tv really FreeBSD (no surprise, at it is, and it isn't ^^).
Look at the kea script for an example, the first 3 / 4 lines.Afaik, pfSense it self, see here /etc/, all de rc...... files - for example rc.bootup - will all all these files.
pfSense handle the hardware and software system events, and call whatever is needed, if system processes like 'unbound' needed to be restarted.
So :
and also during certain system events (e.g. interface link changes, IP address changes, and gateway events).
never saw that happening with my own processes - as pfSense isn't really aware that these are running ones the system is up.