In this article, we’ll cover how to view the status of a service on your dedicated server and, if necessary, how to restart it.
Viewing the Status of a Service
Viewing the status of a service in Linux is important when you want to determine whether it is active and how long it has been running. This allows you to view any associated processes and child processes that might be running as well.
If your system is based on SystemD or SysVinit, systemctl status [service name] is the command you would use to view the status of a particular service. Simply replace [service name] with the name of the specific service you would like to check. For example, if we want to check on our firewall, we would replace [service name] with csf, as shown below:
systemctl status csf
Alternatively, you can use the following command:
service csf status
Restarting a Service
If you have checked a service that is failing or one that is causing issues, you can restart the service in an attempt to resolve the issue. Note that the uptime will reset once the service has been restarted. In the example below, we are restarting the csf service.
systemctl restart csf
Alternatively, you can use service csf restart as shown below.