In OpenRC, runlevels are used to define the state of the system and the services that should be running at any given time. rc-status is a command-line tool that provides information about the current state of the system and the services running in each runlevel.
When run without any arguments, rc-status displays a summary of the current system state. This includes the current runlevel, the services that are running, and the services that are scheduled to start or stop.
rc-status also allows you to specify one or more runlevels as arguments. For example, rc-status default will display information about the default runlevel, while rc-status boot local will display information about the boot and local runlevels.
In addition to displaying information about the current system state, rc-status can also be used to check the status of individual services. You can use the -a option to display information about all services, or you can specify one or more service names as arguments. For example, rc-status sshd will display information about the sshd service.
One of the useful features of rc-status is its ability to display service dependencies. When run with the -d option, rc-status will display a tree diagram showing the dependencies between services. This can be useful for troubleshooting startup problems or understanding how different services are related to one another.
Overall, rc-status is a powerful tool for managing and troubleshooting OpenRC services, and it can provide valuable insights into the state of your system and the services running on it.
If you encounter the below error while running the command rc-status:
rc-status: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install openrc |
Alpine | apk add openrc |
Kali Linux | apt-get install openrc |
Raspbian | apt-get install openrc |
rc-status Command Examples
1. Show a summary of services and their status:
# rc-status
2. Include services in all runlevels in the summary:
# rc-status --all
3. List services that have crashed:
# rc-status --crashed
4. List manually started services:
# rc-status --manual
5. List supervised services:
# rc-status --supervised
6. Get the current runlevel:
# rc-status --runlevel
7. List all runlevels:
# rc-status --list