Quantcast
Channel: Servers | The Linux Juggernaut
Viewing all articles
Browse latest Browse all 30

How To Check The Status Of All The Services In Linux Using A Shell Script

$
0
0

How to write bash shell to check the state 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:If you dont want to run this script you can right away use service command to list all the services which are in running or stopped status

#service –status-all


Viewing all articles
Browse latest Browse all 30

Trending Articles