/etc/local.d

This article describes the setup of scripts in which get executed once during boot or shutdown.

A word of caution
It is a bad idea to abuse this infrastructure to start any other scripts/programs in the background because: For these reasons, it is a lot more convenient to write a real OpenRC initscript file as described in the OpenRC Initscripts chapter of the Gentoo Handbook.
 * if the service script is restarted several times, those scripts/programs will be executed in the background several times, possibly resulting in race conditions
 * a *.stop script for terminating those processes would have to be also present and may easily fail when e.g. the *.start script has been executed several times

Configuration
All scripts in with the suffix .start will be executed at boot time, all scripts with suffix .stop at shutdown time.

To e.g. output the text Hello world! at boot time, create the new file :

Afterwards mark the script as executable:

To start the local.d scripts at boot time, add its init.d script to the default runlevel:

Now start the service by making OpenRC check for stopped services in the default runlevel

or start it explicitly