View Single Post
Posts: 9 | Thanked: 1 time | Joined on Mar 2010
#217
Here is my solution since I am interested in the return code:

Add a desktop widget command that contains the following line:

perl -lae '$_=`sh -c "wget -T 10 --tries=1 --spider http://www.yourserver.com/" 2>&1`;@a=split(/g\ response\.\.\.\ /s,$_);@b=split(/\n/,@a[$#a]);if (!((/failed/)||(/error/))) {print @b[0];} else {print "Error"};'

I think its safe, it should not lock up, but it does sometimes need you click it a few times to confirm its not just a network error on the way to your server.

If you can, I would recommend using the IP of your server to prevent name lookups everytime you run it.

orac.