knowledge/technology/linux/openrc.md

93 lines
No EOL
3.3 KiB
Markdown

---
obj: application
wiki: https://en.wikipedia.org/wiki/OpenRC
repo: https://github.com/OpenRC/openrc
arch-wiki: https://wiki.archlinux.org/title/OpenRC
source: https://wiki.alpinelinux.org/wiki/OpenRC
---
# openRC
OpenRC is a dependency-based init system that works with the system-provided init program
[Service scripts](openrc%20Service%20Script.md) are located at `/etc/init.d`.
The following commands are available to manage the init system:
- Basics:
```shell
rc-update add <service> <runlevel>
rc-update del <service> <runlevel>
rc-service <service> <start stop restart>
```
- To check services and their set runlevels:
```shell
rc-status
```
## rc-update usage
```
Usage: rc-update [options] add service <runlevel>
rc-update [options] del service <runlevel>
rc-update [options] show
Options: [suChqv]
-s, --stack Stack a runlevel instead of a service
-u, --update Force an update of the dependency tree
-h, --help Display this help output
-C, --nocolor Disable color output
-v, --verbose Run verbosely
-q, --quiet Run quietly
```
## rc-status usage
```
Usage: rc-status [options] [runlevel1] [runlevel2] ...
Options: [aclrsuChqv]
-a, --all Show services from all run levels
-c, --crashed Show crashed services
-l, --list Show list of run levels
-r, --runlevel Show the name of the current runlevel
-s, --servicelist Show service list
-u, --unused Show services not assigned to any runlevel
-h, --help Display this help output
-C, --nocolor Disable color output
-v, --verbose Run verbosely
-q, --quiet Run quietly
```
## rc-service usage
```
Usage: rc-service [options]
Options: [e:ilr:ChqVv]
-e, --exists <arg> tests if the service exists or not
-i, --ifexists if the service exists then run the command
-l, --list list all available services
-r, --resolve <arg> resolve the service name to an init script
-h, --help Display this help output
-C, --nocolor Disable color output
-V, --version Display software version
-v, --verbose Run verbosely
-q, --quiet Run quietly
```
## rc usage
```
Usage: rc [options]
Options: [a:o:s:SChqVv]
-a, --applet <arg> runs the applet specified by the next argument
-o, --override <arg> override the next runlevel to change into
when leaving single user or boot runlevels
-s, --service <arg> runs the service specified with the rest
of the arguments
-S, --sys output the RC system type, if any
-h, --help Display this help output
-C, --nocolor Disable color output
-V, --version Display software version
-v, --verbose Run verbosely
-q, --quiet Run quietly
```