Tip: Perl script to Check Site Availability
System Administrators’s ‘common tasks’ are usually monitoring numbers of servers and network connections, and doing each monitoring is rather tedious. So to make our jobs and lives easier, we write scripts to automate repetitive tasks.
Since this is my Linux blog anyway, I decided to share one of scripts that I use in the office. This one is the Perl script that I use to check a specific site if the keyword is present, hence confirming that the site is up and accessible.
In this example I am using dattebayo.com’s parsing URL to test the script.
Dattebayo is one of the subtitling groups that provide fansubs of famous Japanese animes like Naruto and Bleach.
This script requires that you have the following packages installed:
- perl
- mutt
- sendmail or equivalent MTU
Please refrain from parsing the URL too many times or DB will ban your IP. Read their terms of usage here.
#!/usr/bin/perl -w
$get_url=”GET http://dattebayo.com/t/dump”;
$sidebar_list=`$get_url`;
$keyword=”Bleach”;
$date=`date +%c`;
#print $sidebar_list;
if ( $sidebar_list =~ /$keyword/ ) {
# print “Site is UP”;
# print $sidebar_list;
}
else {
`echo “Cannot Open Site. Check Server. \nTime Stamp: $date ” > text_mesg.txt`;
`cat text_mesg.txt|mutt -s “DB Site Error” “kamotegirl\@pinoytux.com”`;
}
Then put this in your crontab set to run every 2 hours so as not to flood the webserver with spurious requests (see above warning).
# crontab -e
Enter this line:
* */2 * * * /home/bom/shippuuden.pl (Change this to where you saved your script)
Save and exit.
Your shippuuden script is now set to run and send email to your address if the site is inaccessible.
Do you find this script useful or trash?
Related Posts
2 Comments to “Tip: Perl script to Check Site Availability”
Post comment
Search PinoyTux
Subscribe to Email Feeds
Blog Lounge
Popular Posts
Recent Posts
Drop your Card Here
Recent Comments
- The_ALL
on How to Increase Wi-Fi Signal - chyrica
on Cebu Pacific Sucks - chyrica
on Cebu Pacific Sucks - wallpat
on Cool Ubuntu-Filipino Wallpapers - celebrity fuck you
on Diablo 3 Coming Soon









Its very simple to check the availability of the website with 100pulse.com
No need to install any software.
A Free and reliable service online.
Выполняю установку и настройку различных CMS систем.
Предоплата 50% стоимость работы от 400р.
Оплата Web Main или Яndex деньги.
Информация для связи ISQ 429606266 Александр.