On CentOS/RHEL, you can use the systemctl command to check if a service is running or not.
Example:
systemctl is-active <service-name>.service
Replace <service-name> with the actual name of the service you want to check. The .service extension is necessary to specify that it is a system service.
The systemctl is-active command returns “active” if the service is running, and “inactive” if it is not.
