Write bash shell to check the status of all services which are running/stopped in Linux?

Ans :

#Created on:02-02-2011 
#Last modified:02-02-2011 
#Purpose:To Check the status of services 
#Author:Surendra Kumar Anne 
#The below for loop will take inputs from chkconfig command to check the services which are running/stoped on the machine. 
for i in `chkconfig --list | awk '{print $1}' | grep -v :`
do 
/sbin/service $i status 
done

This script will take services names from checkconfig command and execute service command on that service.

Update:Recently I came to know that there is a command which you can right away use to list all the services which are in running or stopped status

In Ubuntu

initctl list

In Redhat based:

#service --status-all
Related concept:   SED(Stream EDitor ) Explained in detail for Linux/Unix