Where to put commands that will execute after boot?


I would like to do a few things (set some variable, run some service) but I do not know where to put them.

They should be executed before login, when computer is completely booted up. In case of init 5 (which I use 99.9% of times), before it starts X.

In which file should I put my bash commands?

IIRC /etc/init.d/boot.local is run just before runlevel 5

Humm… I tried that, but neither variable has been set, nor cvs server started.
Wonder what went wrong…

If the cvs server has a file in /etc/init.d/ then you should be able to
use chkconfig to enable it. Variables… if it’s just your user add
them to either .bashrc or .profile which get sourced when starting the

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel
up 1 day 15:42, 1 user, load average: 0.06, 0.02, 0.05
GPU GeForce 6600 TE/6200 TE - Driver Version: 177.80

/etc/init.d/boot.local is executed BEFORE the network has started. If you want to run a CVS server (which requires network) then you will have to write your own bootscript and instruct it to start AFTER the network.

Look in /etc/init.d/skeleton to give you an example how to write one

To make your bootscript start AFTER the network is up and running, you will have to add these lines at the top of the script, after the !/bin/bash line


Provides: cvs

Required-Start: $network

Required-Stop: $network

Default-Start: 3 5

Default-Stop: 0 1 2 6

Short-Description: Start the CVS server


Thanks for info. I do not need CVS server anymore, resolved the problem on another way.

However, I still DO need to execute things, not after the boot, but immediately prior to login prompt (if it is init 3) or “startx” if it is in init 5.

I do not know how to explain…
See this (excert from boot.msg)

Starting smartd done
Starting powersaved: <notice>startproc: execve (/usr/sbin/powersaved)  /usr/sbin/powersaved -d -f /var/run/acpid.socket -v 3 ],  HOME=/ PATH=/bin:/sbin:/usr/bin:/usr/sbin SHELL=/bin/sh RUNLEVEL=5 PREVLEVEL=N DAEMON=/usr/sbin/powersaved ]
Starting Firewall Initialization (phase 2 of 2) done

////// ---- I WANT IT HERE ----

Master Resource Control: runlevel 5 has been reached
<notice>killproc: kill(1549,3)

//// --- OR HERE

Use the /etc/init.d/skeleton and use the variable $all in the required
start and stop.

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel
up 1 day 20:26, 2 users, load average: 0.10, 0.28, 0.25
GPU GeForce 6600 TE/6200 TE - Driver Version: 177.80