LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   help with shell script (https://www.linuxquestions.org/questions/linux-newbie-8/help-with-shell-script-297717/)

amadkow 03-04-2005 03:10 PM

help with shell script
 
I am trying to make a script that will notify me if it can't logon to a website.
So far I found if I run
Code:

GET "http://nexpart.com/do_login.php?nexpartuname=username&pwd=password" |grep -o Invalid
and it can log in it will not display anything but if it fails it will display "Invalid"

My problem is building a script that checks to see if it gets "Invalid" and then e-mails me or somthing if it gets "Invalid".

david_ross 03-04-2005 03:24 PM

You could use:
#!/bin/bash
output=`GET "http://nexpart.com/do_login.php?nexpartuname=username&pwd=password" |grep -o Invalid`

if [ "$output" == "Invalid" ];then
echo Could connect
else
echo Unable to connect | mail you@domain.com
fi

amadkow 03-04-2005 03:38 PM

that doesn't see to use the results of the GET command it always it just compates the GET command it self ot "Invalid"


All times are GMT -5. The time now is 03:58 PM.