execute a small script at startup

as root user during boot sequence (last boot sequence script file).

Could you please tell me how I can do that?

there are lots of scripts in /etc/rc.d

which run level you want your script to be executed during, put your script in /etc/rc.d/rcXXXX.d/yourscript

The above is NOT a good solution. You should never change yourself things in the rc?.d directories.

When you have just a few statements there are three places where you can add them:

  1. in /etc/init.d/boot.local. This one does allready exist and is executed very early in the startup process, directly after boot and before you reach any of the normal runlevel scripts.

  2. in /etc/init.d/before.local. This one is to be created by you and according to the documentation in /etc/initd/rc

# Start the user defined resource control script which
# should be executed _before_ runlevel is entered.

  1. in /etc/init.d/after.local. This one is to be created by you and according to the documentation in /etc/initd/rc
# Start the user defined resource control script which
# should be executed _after_ runlevel is reached.

Do NOT make it a complete script (starting with a shebang) and do not make them executable. They will be ‘sourced’ by the mother script. Thus just add your statements in them.

When it is a more elaborate script that contains sections for start/stop/restart you should make a complete script using /etc/init.d/skeleton as a template.

On 2010-09-03 17:36, rezabakhshi wrote:

> which run level you want your script to be executed during, put your
> script in /etc/rc.d/rcXXXX.d/yourscript

And it will be deleted automatically.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

oh!
thank you both for asking and for answering. I learned something :">