rc-service: command not found

OpenRC is an init system and service manager used by some Linux distributions, such as Alpine Linux and Gentoo. It is designed to be lightweight, fast, and simple, while still providing powerful management of system services.

One of the command-line tools provided by OpenRC is rc-service. This tool allows users to locate and manage OpenRC services, including starting, stopping, restarting, and checking the status of services.

rc-service takes two arguments: the first is the name of the service, and the second is the action to be performed on that service. For example, to start the sshd service, you can use the command rc-service sshd start.

It’s worth noting that the rc-service tool is specific to OpenRC and is not available on other init systems, such as systemd or Upstart. If you’re using OpenRC, however, rc-service can be a powerful tool for managing your system services.

If you encounter the below error while running the command rc-service:

rc-service: 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-service Command Examples

1. Show a service’s status:

# rc-service service_name status

2. Start a service:

# sudo rc-service service_name start

3. Stop a service:

# sudo rc-service service_name stop

4. Restart a service:

# sudo rc-service service_name restart

5. Simulate running a service’s custom command:

# sudo rc-service --dry-run service_name command_name

6. Actually run a service’s custom command:

# sudo rc-service service_name command_name

7. Resolve the location of a service definition on disk:

# sudo rc-service --resolve service_name
Related Post