Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.
More Posts
Pages: 1 2
Dec 12 2013
Bash script to monitor server HTTP output length and e-mail an alert
Pages: 1 2
IDScript
#!/bin/bash # Check for missing IDs - greater output than 103 characters cd "/media/SMALL/scripts" if [[ -z "$1" ]] # check if script arguement exists then a=$(./IDscript "http://server1URL"); a=$(./IDscript "http://scrupt2URL")$a; #concatenate with previous output a=$(./IDscript "http://scrupt3URL")$a; lenA=$(expr length "$a"); if [ $lenA -eq 0 ] #check length of A is empty then echo "No errors"; else mail -s "TID error" [email protected] <<< "There are errors:"$a; # send the e-mail fi exit; fi #create random number from 50 to 99 r=$(( $RANDOM % 50 + 50 )); #bypass HTTP proxy with random number testURL=$1"/checkError?which=IDError&rand="$r; curlOut=$(curl -s "$testURL"); curlLength=$(expr length "$curlOut"); if [ $curlLength -ne 103 ] #103 char is response length when no missing IDs exist then echo "length is not 103:"$testURL; echo -e "n"; fiComments and suggestions are welcome!
Pages: 1 2
Menelaos Bakopoulos
Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.
More Posts
Related posts:
By Menelaos Bakopoulos • Linux, Programming, Scripts, Servers (*ix , scripting) 0