Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to do something as below. There is a website on our office intranet network. It is based in one LAN segment of our office in other location different from where I am based. We are facing the problem due to some VPN issues in accessing this site. For logging purposes to get to the cause of this:

I want to visit this site periodically thorughout the day and find out, when it is accessible(it does work at times) and when it was not reachable(due to our VPN errors)

How can I write a Script to continuously visit this site URL using web browser(mozilla say) after fixed intervals of time and log the result of this action in a text file with time stamp when the browser tried to access this site, if successful or Error Page not found.

share|improve this question

1 Answer 1

Using Autoit, this is a simple test that will run once every 10 seconds to see if the target page source is accessible, it will log the result with a timestamp:

#include <inet.au3>

While 1
    $source = _InetGetSource("domain.tld")
    $file = FileOpen("log.log", 9)
    If $source = "" Then
        FileWrite($file,@MON & "/" & @MDAY & "/" & StringRight(@YEAR, 2) & " " & @HOUR & ":" & @MIN & ":" & @SEC & @TAB & "Failed source pull" & @CRLF)
    Else
        FileWrite($file,@MON & "/" & @MDAY & "/" & StringRight(@YEAR, 2) & " " & @HOUR & ":" & @MIN & ":" & @SEC & @TAB & "Successful source pull" & @CRLF)
    EndIf
    FileClose($file)
    Sleep(10000)
WEnd
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.