This is a small "How to" for checking a service is running in the server or not.
Some times we need to check the status of a service if it is running or not to cross verify something on server. Suppose you have edited your httpd.conf file and when restarting the service it just show start service is on. But when you try to get access to the web site the site is down. At that time we can use below command to check if Apache service is running or not..
Syntax:
Method 1: Using service command
#service servicename status
Example:
#service httpd status
clipped output of the above command
httpd (pid 7474) is running...
Method 2: Using init.d scripts which are located in /etc/init.d folder
Example:
/etc/init.d/cron status
Clipped output of init.d script:
cron start/running, process 1253
Method3: Using status command to check if the service is running or not
Example:
status atd
Output:
atd start/running, process 1245
To check all the services state at a time use below command
#service --status-all
Note: Please make a note that due to formating –status-all is shown as -status-all
Please comment on this if you have any other way to check the status of a service.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018