How to check service status on CentOS Linux Systems ?

How to check service status on CentOS Linux Systems ?

How to check service status in Linux system (CentOS) ?

Whenever we are troubleshooting any issue on server, we have to check service status on server whether they are running or not like Mysql, Apache, SMTP, TCP etc. To find out status of a service in Linux CentOS system, you can use SERVICE command. The synatx of SERVICE command is :

Syntax :
----
# service <servicename> status
OR
# /etc/init.d/<servicename> status

----

Some examples :

1). To check MySQL status on server :
----
# service mysqld status
----

2). To check Apache status on server:
----
# service httpd status
----

3). To check any service status and start it, if it is not running :
----
# service mysqld status
# chkconfig mysqld on
# service mysqld start

----

4). To check status of all services running on CentOS server :
----
# service --status-all
----

You can also use ps or pgrep command to check service status on CentOS Linux Systems.
----
# ps aux | grep 'serviceNameHere' --Syntax
# ps aux | grep 'mysqld' --Example

----
OR
----
# pgrep serviceNameHere --Syntax
//You can match user name also//
# pgrep -u userName serviceNameHere --Syntax
# pgrep mysqld --Example
# pgrep -u mysql mysqld --Example

----
Author
bhawanisingh
Views
4,091
First release
Last update
Rating
0.00 star(s) 0 ratings
Top