Jump to content
Compatible Support Forums
Sign in to follow this  
Lotus

Small Ping Program or Batch file needed.

Recommended Posts

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!

Share this post


Link to post

Look for program called Nagios.

Runs on Linux and I have been told Windows Machines.

Share this post


Link to post
Quote:
What about just putting this in a .bat file and running it as a scheduled task?

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.

Share this post


Link to post

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]

[[/s] [/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.

Share this post


Link to post
Quote:
Quote:
What about just putting this in a .bat file and running it as a scheduled task?

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

Share this post


Link to post
Quote:
Quote:
Quote:
What about just putting this in a .bat file and running it as a scheduled task?

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?

Share this post


Link to post
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!

smile

* 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!

Share this post


Link to post
Quote:
Quote:
Quote:
What about just putting this in a .bat file and running it as a scheduled task?

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?


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.

Share this post


Link to post

I will gladly do the minutes for you as well as test the app. Feel free to e-mail me when you want to get started on the testing. In the meantime, I'll get you your minutes.

 

lotus@prexar.com

Share this post


Link to post

If I understood what it is you wanted, then here is your answer.

 

1034310 total minutes

 

(60 + 61 + 62 + 63 ... + 1430 + 1440)

 

Is this what you wanted APK?

Share this post


Link to post

Sounds really good! I can't wait to try this out!

 

60

120

180

240

300

360

420

480

540

600

660

720

780

840

900

960

1020

1080

1140

1200

1260

1320

1380

1440

Share this post


Link to post

Thanks for taking the time to do this APK, I appreciate it. This is going to come in extremely handy for me, and others I would imagine.

Share this post


Link to post

@Lotus and APK,

 

I've copied the APK Ping into the LeechMeNow folder. Have fun smile

Share this post


Link to post

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!

Share this post


Link to post

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

Share this post


Link to post

Upon closing and re-opening, the IP WAS the one I last pinged. Strange, it was the 127.0.0.1 the last time. Oh well, all is good with it!

Share this post


Link to post

Also, the video card I am using on this machine is an Intel 82810E.

Share this post


Link to post

APK, I seem to be getting errors with this new version. It starts when I try to activate timed pings. The error is as follows:

 

Exception EInvalidOperation in module APKping32.exe at 00013b1a

Cannot focus a disabled or invisible window.

 

then...

 

Access violation at address 00000000. Read of address 00000000.

 

 

 

Any idea's?

Share this post


Link to post

Well you found that quick enough =) I'll wait for the word from jmmijo to download. And thx jmmijo for taking the time to do all this for us.

 

Happy Holidays to you all as well.

 

- Scott / Lotus

Share this post


Link to post
Quote:
Well you found that quick enough =) I'll wait for the word from jmmijo to download. And thx jmmijo for taking the time to do all this for us.

Happy Holidays to you all as well.

- Scott / Lotus


Done!

Let APK know if there are still some bugs to iron out laugh

Share this post


Link to post

You know APK, there is one thing I hadn't looked for in your Toolkit, is there an nslookup app in there ?!? Also a trace route replacement ?!?

 

I used to work at an ISP and I loved using the *nix tools available to do things like look for where the SPAM/UCE came from and notify the offending domain admins of possible abuse wink

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×