Small Ping Program or Batch file needed.
What I need is pretty simple I think. I need a program or batch file that I can setup to ping our vpn three once every 6 hours or so. It would be ideal if the results could be in a log of some sort, but it's not required.
What I need is pretty simple I think. I need a program or batch file that I can setup to ping our vpn three once every 6 hours or so. It would be ideal if the results could be in a log of some sort, but it's not required.
Is there any freeware out there that would do this for me, or would a batch file be the way to go with windows task manager.
It will be used from a Win2k System (SP4)
Thanks for your recommendations!
Is there any freeware out there that would do this for me, or would a batch file be the way to go with windows task manager.
It will be used from a Win2k System (SP4)
Thanks for your recommendations!
Participate on our website and join the conversation
This topic is archived. New comments cannot be posted and votes cannot be cast.
Responses to this topic
What about just putting this in a .bat file and running it as a scheduled task?
Code:
Code:
ping -n 5 www.yahoo.com >> c:\log.txt
Quote:What about just putting this in a .bat file and running it as a scheduled task?
Code:
That was what I tried to begin with. Doesn't work. Just flashes the .bat on the screen for .2 seconds then closes. No ping is done, no log is created.
Thank you for your reply though.
Code:
ping -n 5 www.yahoo.com >> c:\log.txt
That was what I tried to begin with. Doesn't work. Just flashes the .bat on the screen for .2 seconds then closes. No ping is done, no log is created.
Thank you for your reply though.
There's a switch you can add after cmd.exe that will keep the window open until the batch file is complete, I believe it's /c.
For example:
cmd.exe /c pingtest.bat
Quote:CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[ [/C | /K] string]
/C Carries out the command specified by string and then terminates
Note that multiple commands separated by the command separator '&&'
are accepted for string if surrounded by quotes. Also, for compatibility
reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the
same as /C. Any other switches are ignored.
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
the two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.
That was from CMD /? at a cmd prompt, if you're curious. There's a lot more information there, too, but the majority of it was irrevelant in your case.
For example:
cmd.exe /c pingtest.bat
Quote:CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[ [/C | /K] string]
/C Carries out the command specified by string and then terminates
Note that multiple commands separated by the command separator '&&'
are accepted for string if surrounded by quotes. Also, for compatibility
reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the
same as /C. Any other switches are ignored.
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
the two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.
That was from CMD /? at a cmd prompt, if you're curious. There's a lot more information there, too, but the majority of it was irrevelant in your case.
Quote:Quote:What about just putting this in a .bat file and running it as a scheduled task?
Code:
That was what I tried to begin with. Doesn't work. Just flashes the .bat on the screen for .2 seconds then closes. No ping is done, no log is created.
Thank you for your reply though.
Strange, it worked perfectly for me.
-bZj
Code:
ping -n 5 www.yahoo.com >> c:\log.txt
That was what I tried to begin with. Doesn't work. Just flashes the .bat on the screen for .2 seconds then closes. No ping is done, no log is created.
Thank you for your reply though.
Strange, it worked perfectly for me.
-bZj
Quote:Quote:Quote:What about just putting this in a .bat file and running it as a scheduled task?
Code:
That was what I tried to begin with. Doesn't work. Just flashes the .bat on the screen for .2 seconds then closes. No ping is done, no log is created.
Thank you for your reply though.
Strange, it worked perfectly for me.
-bZj
I found where my problem was. Now it's working as it should. Is there a way to timestamp the log?
Code:
ping -n 5 www.yahoo.com >> c:\log.txt
That was what I tried to begin with. Doesn't work. Just flashes the .bat on the screen for .2 seconds then closes. No ping is done, no log is created.
Thank you for your reply though.
Strange, it worked perfectly for me.
-bZj
I found where my problem was. Now it's working as it should. Is there a way to timestamp the log?
Quote:
Let me know the exacts on it, sounds like you want an hourly counter & test of connection type of pinger... mine is not far from that & I could add a feature like that in pretty easy I think, bit of math on 1 minute timers work + a variable that acts as a counter for the number of hours to do ping checks in question.
Quote:Is there any freeware out there that would do this for me, or would a batch file be the way to go with windows task manager.
It will be used from a Win2k System (SP4)
Thanks for your recommendations!
Yes, there might be... I can add that into my pinger pretty easy now that I think about it!
* Put it this way, there might be one... for Win32, & pretty soon! Good idea for another app of mine to modify to do that exact function!
APK
Yes an hourly counter to check if our server is online. It would be great if it could write the results to a log and have those results timestamped. If you find the time to do this, let me know!
Let me know the exacts on it, sounds like you want an hourly counter & test of connection type of pinger... mine is not far from that & I could add a feature like that in pretty easy I think, bit of math on 1 minute timers work + a variable that acts as a counter for the number of hours to do ping checks in question.
Quote:Is there any freeware out there that would do this for me, or would a batch file be the way to go with windows task manager.
It will be used from a Win2k System (SP4)
Thanks for your recommendations!
Yes, there might be... I can add that into my pinger pretty easy now that I think about it!
* Put it this way, there might be one... for Win32, & pretty soon! Good idea for another app of mine to modify to do that exact function!
APK
Yes an hourly counter to check if our server is online. It would be great if it could write the results to a log and have those results timestamped. If you find the time to do this, let me know!
Quote:Quote:Quote:
Thank you for your reply though.
Strange, it worked perfectly for me.
-bZj
I found where my problem was. Now it's working as it should. Is there a way to timestamp the log?
In your .bat file have the lines
Code:
That will give you the timestamp (in the format "11:26:24.88 Thu 12/18/2003") right above the ping results.
What about just putting this in a .bat file and running it as a scheduled task?That was what I tried to begin with. Doesn't work. Just flashes the .bat on the screen for .2 seconds then closes. No ping is done, no log is created.
Code:ping -n 5 www.yahoo.com >> c:\log.txt
Thank you for your reply though.
Strange, it worked perfectly for me.
-bZj
I found where my problem was. Now it's working as it should. Is there a way to timestamp the log?
In your .bat file have the lines
Code:
echo ---------------------------echo %TIME% %DATE% >> c:\log.txtping -n 5 www.yahoo.com >> c:\log.txt
That will give you the timestamp (in the format "11:26:24.88 Thu 12/18/2003") right above the ping results.
It's currently running without any problems. I like what you've done with it. The timed pings are working as they should, and the log file is just what I needed.
I have a couple idea's for you, not sure how easy it would be to implement them.
I'll test it for another day or so, then give you my thoughts. But so far so good!
Thanks for doing it so quick!
I have a couple idea's for you, not sure how easy it would be to implement them.
I'll test it for another day or so, then give you my thoughts. But so far so good!
Thanks for doing it so quick!
Well, I'll tell you, from a users stand point, TABS are a great thing. I think that adding tabs would make the program a little more stylish. I LOVE the idea of adding a notification/warning message stating that the IP/name your pinging is down/offline. If you added along with that message the time it went down, it would be extremely handy. To be able to toggle that option on and off with a checkbox is a great idea as well.
So far the one thing I noticed (bug related?) is that when I minimize and hide screen, the names of the icons on the desktop hide as well =) Easily brought back by clicking them. But still, thought you should know.
I would also like to see the program remeber IP address I recently pinged. I notice if I shut it down and the restart it, the IP defaults back to 127.0.0.1. Maybe even add a drop down menu for IP's/names you have pinged. It would be just a convenience option.
I'll give you more comments soon, got to get back to work!
Regards,
Scott / Lotus
So far the one thing I noticed (bug related?) is that when I minimize and hide screen, the names of the icons on the desktop hide as well =) Easily brought back by clicking them. But still, thought you should know.
I would also like to see the program remeber IP address I recently pinged. I notice if I shut it down and the restart it, the IP defaults back to 127.0.0.1. Maybe even add a drop down menu for IP's/names you have pinged. It would be just a convenience option.
I'll give you more comments soon, got to get back to work!
Regards,
Scott / Lotus