SHELL script
If you're new here, you may want to subscribe to my RSS feed. Also you may want to leave a comment to the posts. xD Thanks for visiting! |m|
at last!.. i have made my first successful shell script (not literally the first… just want to exaggerate it.. lolx)
the “simple” script that i made will just ping a host specified.. then show port 80 and 21 status.. and that’s it.. (lame script!.. lolx)
here’s the scipt:
#!/usr/local/bin/bash
echo “=============SERVER PING STATS============”;
ping -c3 $1
echo “==========================================”;
echo ” “;
echo “=========HTTP PORT CHECK(port 80)=========”;
nc -vvv -z $1 80
echo “Done!”;
echo “========END OF PORT CHECK(port 80)========”;
echo ” “;
echo “==========FTP PORT CHECK(port 21)==========”;
nc -vvv -z $1 21
echo “Done!”;
echo “========END OF PORT CHECK(port 21)=========”;
echo ” “;
I saved the script as portcheck and chmodded to 700…
here’s the result:
[+_Fueled_By_Ramen_+@root:~]—> portcheck tambayanbox.org
=============SERVER PING STATS============
PING tambayanbox.org (74.208.24.212): 56 data bytes
64 bytes from 74.208.24.212: icmp_seq=0 ttl=55 time=341.001 ms
64 bytes from 74.208.24.212: icmp_seq=1 ttl=55 time=336.076 ms
64 bytes from 74.208.24.212: icmp_seq=2 ttl=55 time=324.186 ms
— tambayanbox.org ping statistics —
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 324.186/333.754/341.001/7.058 ms
==========================================
=========HTTP PORT CHECK(port 80)=========
Connection to tambayanbox.org 80 port [tcp/http] succeeded!
Done!
========END OF PORT CHECK(port 80)========
==========FTP PORT CHECK(port 21)==========
Connection to tambayanbox.org 21 port [tcp/ftp] succeeded!
Done!
========END OF PORT CHECK(port 21)=========
me… happy… lolx…
Check out this Related Posts
Comments
Leave a Reply







