need app to ping an IP address 1 time every hour

MrHappyMonkey

Diamond Member
Mar 15, 2001
3,091
0
0
I am having a problem with a remote DNS server that has been rather flakey lately. Is there an app available for WinXP that can PING the IP every hour and write to a log whether the PING was successful or not?
thanks.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Install python and:

import time, os
while 1:
os.system("echo %s >> c:\\path\\to\\log.txt" % time.asctime())
os.system("ping foobar.com >> c:\\path\\to\\log.txt")
time.sleep(3600)

or install cygwin, and:

while true; do ping -c 1 foobar.com >> mylog.txt; sleep 3600; done
 

xcript

Diamond Member
Apr 3, 2003
8,258
2
81
Or you could create a batch file containing:

  • @echo off

    set host=host.com
    set log=log.txt

    date /t >>%log%
    time /t >>%log%

    ping -n 1 %host% >nul

    if not errorlevel 1 goto THEN

    goto ELSE

    :THEN
    echo %host% is up.. >>%log%
    goto END_IF

    :ELSE
    echo %host% is down.. >>%log%
    goto END_IF

    :END_IF

    echo. >>%log%

and have a scheduled task execute it hourly.

Later.. :beer:

Edit: Made it nicer. :)
Edit2: Made it even nicer. :Q
 

MysticLlama

Golden Member
Sep 19, 2000
1,003
0
0
And to do scheduled tasks without using the GUI, do the following (it seems to be more reliable)

at 05:00 /INTERACTIVE /every:T,Th,S,Su "c:\stuff\newapp.bat" /switchfornewapp

The time is 24 hour.

/Interactive allows it to be run on the desktop vs. in the background if you need to do it that way.

/every is the days it runs on.

I put all of my tasks in a batch file like so:

rem start by clearing jobs
at /delete /yes

rem Run such and such program one
at 01:00 /INTERACTIVE /every:T,W,Th,F,S,Su "C:\Filename" /switch1 /switch2

rem Run such and such program two
at 02:00 /INTERACTIVE /every:T,W,Th,F,S,Su "C:\Filename2" /switch1

The jobs stay after reboots, so to make changes you have to clear them all out. I just put the batch file in my startup folder and that way it makes sure it's always right. Also, I can just make a quick edit and rerun the batch file and it makes it consistent again by clearing all and recreating the jobs.
 

Vegito

Diamond Member
Oct 16, 1999
8,329
0
0
you need something like..

ping server x
server x returns ping time of y

if ping = 5y - ping every 30 sec
if ping = 4y - ping every 1 min
if ping = 3y - ping every 5 min
if ping = 2y - ping every 10 min
if ping = y - resume hourly schedule

If ur getting higher pings, you probably want to ping it continously to make sure its up.. else goto the normal 1 hour schedule

find that program :)