Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:system:init_systems:openrc [2022/10/24 15:34]
throgh [Migration]
en:system:init_systems:openrc [2022/10/24 18:43] (current)
throgh [Runlevels]
Line 71: Line 71:
 </code> </code>
 ===== Runlevels ===== ===== Runlevels =====
-OpenRC, as well as sysvinit and init (BSD), has a concept of task execution levels (Runlevels), to define them OpenRC uses names instead of numbers as it is done in the conventional way. There are two types of runlevels:+OpenRC, as well as sysvinit and init (BSD), has a concept of task execution levels (Runlevels), to define them OpenRC uses names instead of numbers as it is done in the conventional way. This allows, for example, to have a default runlevel with "everything" enabled, and a "powersaving" runlevel where some services are disabled.
  
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+The <color #0B71B9/#DDF1FF>rc-status</color> helper will print all currently active runlevels and the state of services in them:
  
 +<code bash>
 +# rc-status
 + * Caching service dependencies ... [ ok ]
 +Runlevel: default
 + modules                      started  ]
 + lvm                          started  ]
 +</code>
  
-!?(WIP)!?!?+All runlevels are represented as folders in <color #0B71B9/#DDF1FF>/etc/runlevels/</color> with symlinks to the actual service scripts.
  
 +Calling openrc with an argument (<color #0B71B9/#DDF1FF>openrc default</color>) will switch to that runlevel; this will start and stop services as needed.
 +
 +Managing runlevels is usually done through the <color #0B71B9/#DDF1FF>rc-update</color> helper, but could of course be done by hand if desired. e.g.
 +<color #0B71B9/#DDF1FF>rc-update add nginx default</color> - add nginx to the default runlevel with the need of root-privileges.
 +
 +<note important>The command **rc-update** will not start nginx! You would still have to trigger rc, or run the service script by hand, or start it with **rc-service nginx start**.</note>
 +
 +The default startup uses the runlevels <color #0B71B9/#DDF1FF>sysinit</color>, <color #0B71B9/#DDF1FF>boot</color>, and <color #0B71B9/#DDF1FF>default</color>, in that order. Shutdown uses the <color #0B71B9/#DDF1FF>shutdown</color> runlevel. The defined runlevel <color #0B71B9/#DDF1FF>nonetwork</color> is used only for non-network services.
 ====== OpenRC ====== ====== OpenRC ======