rc.d services issues

Hello all!

I try to solve trivial tasks when starting services but I can not find any solutions.

1. set/add/edit REQUIRE for service without direct editing service's rc scripts. Example in rc.conf file something like this ${service}_requires=+jail to add jail service dependency before start ${service}.
Using ${service}_env in rc.conf file gives me the error response `env: defaultroute: No such file or directory` when I try to copy all REQUIRE from rc script of service. I can not edit rc files because they are overwritten after service update and my changes are dropped.

2. I need start some shell command before start service WHITHOUT editing rc scripts. I have not found any resolution for this requirements.

Perhaps someone can help me with these requests.
 
Have a look at the rcorder(8) command. Note how the files in /etc/rc.d and /usr/local/etc/rc.d are sorted before execution at boot time:
  • REQUIRE, PROVIDE, BEFORE, and KEYWORD directives impact execution ordering;
  • operands of these keywords in lower case exist as executable shell scripts; and
  • operands of these keywords in upper case, e.g. DAEMON, also exist as files but are dummy compound dependencies, used to ensure the correct ordering of other dæmons.
You can add your own rc scripts to /usr/local/etc/rc.d. They will not be smashed with a system update. They can impact the global ordering of rc script execution by using BEFORE and REQUIRE directives.

As a skeleton example of an rc script you could create, look at /etc/rc.d/swap. Setting "start_cmd=':'" would make it do nothing, except enforce the rc script execution ordering via the directives at the top of the file.
 
Back
Top