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