Bash Script to Ping Servers and Checks Services Status

#!/bin/bash
########################################################################
#Script to ping servers and Checks Services [oracle,pmon,smon,tns] for Status
#
#######################################################################

#List of IP addresses
array_serverIP="10.0.0.1 192.168.0.1"
array_SERVICES="oracle pmon smon tns"

for ip in $array_serverIP ;
do
(
ping $ip  -c2 &> /dev/null ;
if [ $? -eq 0 ];
then
        echo "$ip is Up"
else
        echo "$ip is Down"
fi
)&
done
wait

for SERVICE in $array_SERVICES;
do(
if ps -ef | grep -v grep | grep $SERVICE > /dev/null;
then
    echo $SERVICE " is running, everything fine"
else
   echo $SERVICE " is not running"

fi
)&
done
wait

Script to ping servers and Checks Services [oracle,pmon,smon,tns] for Status

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: