How OpenRC Works
/etc/inittab Init needs a configuration file that specifies what actions need to be taken. This configuration file is /etc/inittab
|
sysinit init's first action is to mount all file systems. This is defined in the following line from /etc/inittab. si::sysinit:/sbin/openrc sysinit
|
bootwait init's second action is to execute all scripts that had symbolic links in /etc/runlevels/boot/. This is defined in the following line from /etc/inittab. rc::bootwait:/sbin/openrc boot
|
initdefault init checks its configuration file to see what runlevel it should run. To decide this, it reads the following line from /etc/inittab. id:3:initdefault:
|
runlevel In this casethe runlevel id is 3. Using this information, init checks what it must run to start runlevel 3. l3:3:wait:/sbin/openrc default
. The line that defines level 3, again, uses the openrc script to start the services (now with argument default)
|
consoles init decides what virtual consoles it should activate and what commands need to be run at each console. c1:12345:respawn:/sbin/agetty 38400 tty1 linux c2:12345:respawn:/sbin/agetty 38400 tty2 linux c3:12345:respawn:/sbin/agetty 38400 tty3 linux c4:12345:respawn:/sbin/agetty 38400 tty4 linux c5:12345:respawn:/sbin/agetty 38400 tty5 linux c6:12345:respawn:/sbin/agetty 38400 tty6 linux
|
|
|
Runlevels
sysinit |
shutdown |
reboot |
boot |
default |
nonetwork |
single |
Initscripts
Working with initscripts The scripts that the openrc process starts are called init scripts. Each script in /etc/init.d/ can be executed with the arguments start, stop, restart, zap, status, ineed, iuse, iwant, needsme, usesme, or wantsme.
|
Start a service /etc/init.d/postfix start
|
Stop a service, but not the services that depend on it /etc/init.d/postfix --nodeps stop
|
See what status a service has /etc/init.d/postfix status
|
Ask what dependencies the service has /etc/init.d/postfix ineed
|
Ask what services require the service /etc/init.d/postfix needsme
|
|
|
Configuring services
/etc/conf.d Every init script that can be configured has a file in /etc/conf.d/. For instance, the apache2 initscript (called /etc/init.d/apache2) has a configuration file called /etc/conf.d/apache2, which can contain the options to give to the Apache 2 server when it is started. Such a configuration file contains only variables.
|
Replacing default runlevel
Replace runlevel Add a new entry in the bootloader configuration for the desired runlevel. In that entry, add softlevel=desired
as a boot parameter.
|
Working with runlevel
Change to nonetwork runlevel |
rc nonetwork |
Change to default runlevel |
rc default |
Change to shutdown runlevel |
rc shutdown |
Change to reboot runlevel |
rc reboot |
Show status info about runlevels |
rc-status [runlevel] |
Locate and run an OpenRC service |
rc-service service cmd [...] |
Adding services |
rc-update add postfix default |
Removing services |
rc-update del postfix default |
Showing services |
rc-update show |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by misterrabinhalder