5

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...

1
  • 3
    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.
    – Chris S
    Aug 1, 2013 at 14:19

2 Answers 2

7

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.

0

Of course it is a bad idea to patch existing scripts, they will be overwritten after an upgrade. You may create another script which does nothing, but contains REQUIRE and BEFORE keywords, this way it will swap the order of two other scripts.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .