On FreeBSD, what is the correct/canonical way of specifying that one rc script is reliant on another, such that each time the service it depends on is restarted, the dependent service is then restarted also?

For example, on my FreeBSD server, any time the network configuration is changed, the poorly-written avahi-daemon will no longer work until it is restarted. How can I specify that each time /etc/rc.d/netif is (re)started, /usr/local/etc/rc.d/avahi-daemon must be restarted?



The rcorder utility looks at the rcNG scripts in /etc/rc.d and /usr/local/etc/rc.d and works out in which order they are to be run (by analysing the PROVIDE, REQUIRE and KEYWORD headers), but it is only effective at boot time, or when switching from single-user to multi-user mode - that is, whenever /etc/rc itself is called.

As far as I know, there is no formalised approach in FreeBSD to the problem you are trying to solve of selectively restarting specific daemons or services, so I think you will have to write your own control scripts that can correctly take care of restarting things for you; you can probably leverage the work already done in rcorder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.