Quantcast
Channel: Script to test staging server statuses - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 2

Script to test staging server statuses

$
0
0

I am just trying to write a script to test the staging server statuses for my organization. What I am looking is to add a loop in the script, that checks all the server status and alerts us by an email or a message something like that when a server broken down or low!

This is how we want the script to look like, I am not sure how to write it.

#!/bin/bash
array[server1, server2..]
 loop()
   if (condition to check all the servers)
   then
     echo "server is in good status"
   else
     echo "server is down" -->if its down an email to 
                                    Example@example.com
   fi

This is what I tried, any suggestion and help please will be great!

#!/bin/bash

    ping -c $1
    if [ $? -eq 0 ]
    then
          echo "server is alive"
    else
         echo "this was't was good server"
    fi 

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images