Thursday, August 4, 2011

Getting status of all services in Linux

Below is the script to find out status of all services on linux system.

#Created on:04-08-2011
#Last modified:04-08-2011
#Purpose:To Check the status of services
#The below for loop will take inputs from chkconfig command to check the services which are running/stopped on the machine.
for i in `chkconfig --list | awk '{print $1}' | grep -v :`
/sbin/service $i status
there is one another way of doing this task is just use single command.

#service --status-all
[root@localhost ~]$  service --status-all
acpid (pid 2467) is running...
amd is stopped
anacron is stopped
arpwatch is stopped
atd (pid  2992) is running...
auditd (pid  2253) is running...
automount (pid 2660) is running...
Avahi daemon is running
Avahi DNS daemon is not running
bgpd is stopped
hcid (pid 2390) is running...
sdpd (pid 2396) is running...
capi not installed - No such file or directory (2)
clamav-milter (pid 2834) is running...


Kuldeep Sharma