Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Desktop Command Execution Widget scripts

    Reply
    Page 22 of 42 | Prev | 12   20     21   22   23     24   32 | Next | Last
    orac | # 211 | 2010-03-28, 18:58 | Report

    Originally Posted by KiberGus View Post
    May be you should make asynchronous communication with executed commands?
    That's a good thought. I was really liking this widget until it locked up sometimes when roaming. I realised like you guys here, its that some commands don't complete.

    In particular, any use of wget requires the "-T" option be set.

    I like the real IP preloaded command, by adding "-T 5" it now never locks up.

    Maybe at the least, improve the default scripts not to lock up.

    Later you can try a "throw and catch" execution model.

    Great widget,

    orac.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to orac For This Useful Post:
    cpscotti

     
    TheSov | # 212 | 2010-03-29, 02:42 | Report

    can anyone help me out, i would like to use this widget to check the status of a webserver, does anyone have a cmd that does that?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    x-lette | # 213 | 2010-03-29, 08:17 | Report

    Originally Posted by TheSov View Post
    can anyone help me out, i would like to use this widget to check the status of a webserver, does anyone have a cmd that does that?
    What do you mean with status? The Webserver (http-Server) can be checked with a wget command. Whether the machine itself is up and running could be tested with a simple ping. For nearly any service running there is a simple tool to check it's status.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    TheSov | # 214 | 2010-03-29, 17:30 | Report

    Originally Posted by x-lette View Post
    What do you mean with status? The Webserver (http-Server) can be checked with a wget command. Whether the machine itself is up and running could be tested with a simple ping. For nearly any service running there is a simple tool to check it's status.
    status like to see if its running the site, so i could use wget to get the file but how do i signal to the widget if it fails?

    i consulted some people and the best i have is this

    wget --timeout=10 --tries=1 http://mywebsite/sometestfile.txt
    echo "$?"

    thats it.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by TheSov; 2010-03-29 at 17:53.

     
    x-lette | # 215 | 2010-03-29, 20:27 | Report

    that might work if you know what the return codes mean. easier might be clear text message like following:
    wget .... && echo "success" || echo "fail"
    the last echo will only fire up if one of the previous commands fails and an echo never fails

    Edit | Forward | Quote | Quick Reply | Thanks

     
    TheSov | # 216 | 2010-03-29, 20:57 | Report

    I was actually able to accomplish it by this thanks to the awesome people on freenode's #linux

    first i created a script called qwebcheck in /usr/bin
    Code:
    wget --timeout=10 -O /dev/null http://theserveruwanttocheck.xxx/somefile.html
    if [ $? -eq 1 ] ; then exit 2 ; fi
    echo "System OK"
    chmod the script +x and then add a new command and type in your script name and WALA!

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by TheSov; 2010-03-30 at 04:59.

     
    orac | # 217 | 2010-03-30, 06:05 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    x-lette | # 218 | 2010-03-30, 07:57 | Report

    Originally Posted by orac View Post
    If you can, I would recommend using the IP of your server to prevent name lookups everytime you run it.
    Raw IP will work only if you are running a dedicated server (or virtual server) with own IP. If you only got webspace somewhere this would not ensure that your website can get accessed.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    orac | # 219 | 2010-03-30, 08:14 | Report

    Originally Posted by x-lette View Post
    Raw IP will work only if you are running a dedicated server (or virtual server) with own IP. If you only got webspace somewhere this would not ensure that your website can get accessed.
    Which is why I am interested in the status response and why I started with if you can.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    hellnick | # 220 | 2010-03-30, 08:22 | Report

    Originally Posted by TheSov View Post
    can anyone help me out, i would like to use this widget to check the status of a webserver, does anyone have a cmd that does that?
    Consider installing Queen Beecon

    The following script was posted on Reddit by theSov:

    before we start install queenbeecon drop to a shell and create the following script in your /usr/bin

    wget -O /dev/null http://theserveruwanttocheck.xxx/somefile.html

    if [ $? -eq 1 ] ; then exit 2 ; fi

    echo "System OK"

    save it, chmod +x it.

    then you add a widget for queenbeecon

    edit the widget, click on add command type any name u want and the name of the script you created under "command" set any settings u want. select "when connected" and your auto update at the bottom of the widget properties and there you go, remote monitoring on the go.

    screens: http://imgur.com/WfosH.png http://imgur.com/QtyLo.png



    Haven't tried it yet as just being lazy at the moment.

    Edit. Note that Queen Beecon is in Extras Dev so usual warnings apply

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by hellnick; 2010-03-30 at 08:31.

     
    Page 22 of 42 | Prev | 12   20     21   22   23     24   32 | Next | Last
vBulletin® Version 3.8.8
Normal Logout