Linux Commands

How to Restart a Service on Alpine Linux

Operating systems contain a ton of services to make your experience smoother. However, these services sometimes show bugs and need to be fixed. Hence, it is good to restart the services to remove the issues and let the services work consistently. However, Linux distros like Ubuntu and Linux Mint offer a simple way to restart a service, unlike with Rocky Linux and Alpine Linux. This short guide briefly explains how to restart a service on Alpine Linux.

How to Restart a Service on Alpine Linux

We will see how to restart a running service on Alpine Linux using a few simple commands.

First, we list all the services using the following rc command:

rc-status

As you can see, all the previous services are running in three types of runlevels: default, needed, and manual. The previous command shows all the services at the current runlevel by default.

You can restart the services that are running in all the mentioned runlevels. The general syntax to restart any service on Alpine Linux is as follows:

rc-service <service-name> restart

Moreover, you can run the following command to restart the service:

/etc/init.d/<service-name> restart

First of all, we restart the “udev” service that runs under the default runlevel with the help of the following command:

rc-service udev restart

Similarly, you can also restart the services of the needed runlevel. We restart the “sysfs” from all the services that are running at the needed runlevel of our system. For this, we use the following command:

/etc/init.d/sysfs restart

Lastly, we restart the “openrc-settingsd” service from the manual runlevel by running the following command:

 rc-service openrc-settingsd restart

In this way, you can restart the services of Alpine Linux.

Conclusion

We explained how to restart a service on Alpine Linux. Alpine Linux organizes services according to their run levels. The procedure to start the services of all run levels is the same. In Alpine Linux, you can restart the services using two commands: “/etc/init.d/<service-name> restart” and “rc-service <service-name> restart”.

Here, we have seen how to restart an Alpine Linux service using the given commands. With this guide’s help, you can easily restart the Alpine Linux service.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.