How to change rc.d startup order in FreeBSD?

5,176

rc startup order is determined by rcorder, as you've already determined.

This process for determining startup order is automatic, and the man page for rcorder is relatively self-explanatory, but you may will want to spend some time reviewing Practical rc.d scripting, and the rc man page before making any changes.


In your particular case, you can tell rcorder that your script prefers to start BEFORE: other scripts (using the BEFORE keyword), but this should only be done with good reason, and within certain limits.
From the Practical rc.d scripting article:

Note: The BEFORE: line should not be abused to work around an incomplete dependency list in the other script. The appropriate case for using BEFORE: is when the other script does not care about ours, but our script can do its task better if run before the other one. A typical real-life example is the network interfaces vs. the firewall: While the interfaces do not depend on the firewall in doing their job, the system security will benefit from the firewall being ready before there is any network traffic.

And additionally

Keep in mind that putting a service name in the REQUIRE: line does not guarantee that the service will actually be running by the time our script starts. The required service may fail to start or just be disabled in rc.conf(5). Obviously, rcorder(8) cannot track such details, and rc(8) will not do that either. Consequently, the application started by our script should be able to cope with any required services being unavailable.

Share:
5,176

Related videos on Youtube

ibrahim
Author by

ibrahim

Updated on September 18, 2022

Comments

  • ibrahim
    ibrahim almost 2 years

    My question exactly same as this question except I want to change services in FreeBSD.

    I made some research and I found rcorder command which gives full order of services with below paramaters.

    rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
    

    In addition, I can add REQUIRE option of any rc.d script in order to start my service before it. I didn't like this way because I don't want to change other programs' rc.d scripts. Is there any more proper way to do this?

    Thanks...

    • Philip
      Philip almost 11 years
      What are you actually trying to do? The order really should not be changed unless you've got a spectacular reason for doing so. Changing the Provide, Require, and Before lines are the correct method, but again not something that should be messed with.