Advertisement

08.24.2008 at 06:38PM PDT, ID: 23674310
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.9

Windows MSDOS scripting (.cmd & .bat) questions (Errorlevel  & equivalent of Unix sleep)

Asked by sunhux in Windows Batch Scripting, MS DOS, Automation

Tags: , , ,

Hi,

Need some help with writing a short MSDOS Windows script to monitor
a website's status & email the status out.  The script will be run once a
day by Windows scheduler (script will loop 48 times x 15 minutes in a
day).  In case a Website/link is down, the script will send a notification
email & then exit/stop (& not keep sending notification email every  15
minutes).

I'm using a utility called wget-1.10.exe to check a website's status.
I know how to handle the emailing part as I have a tool to do that, so
you may assume I have no problem with emailing part.

Refer to the draft codes below, I have 3 questions :

a)is my coding for iterating/looping 48 times correct or give
   me the correct coding for the .cmd or .bat if my codes below
   are incorrect

b) "if not Errorlevel 0  echo website is down > status.txt" -
     when I tested the above codes by echoing to screen (instead
     of to an output file), regardless of whether the website is up
     or down, it always echo nothing out  regardless of the value
     of Errorlevel (ie whether the text "connected" is found or not).
     What am I missing here?
     How do I enclose the "if" loop which has 3 actions (need actual codes) :
        echo ... > status.txt
        send email out   (this part I know)
        exit  (ie stop further execution of script)
       
c) in Unix shell scripting, we have "sleep x" to pause the script for x seconds
    - how do we achieve this in MSDOS/Windows scripting?

Thanks

+++++++++++++++++++ Checkwebpage.bat :+++++++++++++++++++++
n=0
Loop:
n=n+1
if n > 48  then exit this script   <== a) iterate 48 times
wget-1.10 --tries=1 --proxy tanglinvillage.com > a.txt  2> a.err
find "connected" a.err
if not Errorlevel 0  echo website is down > status.txt  
    (& email out status.txt & exit this script)  <== b)
sleep 15minutes    <== c) how to achieve this?
goto Loop
------------------------------------ End of script --------------------------------------Start Free Trial
[+][-]08.24.2008 at 07:58PM PDT, ID: 22302915

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Windows Batch Scripting, MS DOS, Automation
Tags: Microsoft, Windows MSDOS scripting (.cmd & .bat), XP professional, Windows MSDOS scripting (.cmd & .bat) questions
Sign Up Now!
Solution Provided By: doraemon2555
Participating Experts: 2
Solution Grade: B
 
 
[+][-]08.24.2008 at 08:51PM PDT, ID: 22303119

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 09:19PM PDT, ID: 22303192

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 09:24PM PDT, ID: 22303203

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 09:43PM PDT, ID: 22303263

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 12:49AM PDT, ID: 22303802

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.25.2008 at 12:50AM PDT, ID: 22303816

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.25.2008 at 09:28PM PDT, ID: 22311602

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628