[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

How to Ping 2 websites

Experts,

I am stuck on how to figure out how to Ping yahoo.com 3 separate times and google.com 3 separate times waiting 1 minute between pings.   I looked at the supported data for my previous question cant seem to get it to work.  

My thoughts:

Not sure how what the syntax would be for 2 websites but for one I was thinking
ping -w 60000 -n 3 www.google.com

After researching I realized that -w is only to be used for a wait before a timeout.  Any ideas?  I am looking to have it wait 1 minute between a total of 6 pings to yahoo and google.  
0
Maliki Hassani
Asked:
Maliki Hassani
  • 11
  • 8
  • 2
1 Solution
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
@echo off
ping -n 3 www.yahoo.com
sleep 60
ping -n 3 www.googl.com

Open in new window


and use sleep from here

http://www.computerhope.com/dutil.htm 
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
sleep is just a simple utility, to pause for however many seconds

sleep <seconds to sleep>

simple use.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
typo missed the e off google!
0
Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

 
Maliki HassaniAuthor Commented:
So for the 1 - 4 steps am I hitting enter?  Wouldn't that just run it and never get to step 4?
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
no it runs' puses for 60 seconds and contiues.

you need to copy and paste into a batch file, called pingtest.bat
0
 
Maliki HassaniAuthor Commented:
Sorry, I am not sure how to create a batch file. Let me google this..
0
 
t-maxCommented:
Usually I use "ping -n 60 localhost" to wait 1 minute. You can put that between your other pings to make a one-minute delay. Hope this helps. Good luck!
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
notepad pingtest.bat

cut and paste the above into notepad.

Save the file.

download sleep into same folder as batch file.

run pingtest.bat
0
 
Maliki HassaniAuthor Commented:
Thanks T-max
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
ping -n 60 is 60 counts, not 60 seconds. (it could be close, but you've got more than 3 pings!)

still need a batch file.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
and if you response time is slower, then it will be longer than 60 seconds.
0
 
Maliki HassaniAuthor Commented:
Okay so I did what you said and it only waits 60 seconds then ends..  It should wait 60 seconds for 6 times.  Am I reading this wrong?
0
 
Maliki HassaniAuthor Commented:
what about:

ping -n 1 www.yahoo.com
sleep 60
ping -n 1 www.yahoo.com
sleep 60
ping -n 1 www.yahoo.com
sleep 60

ping -n 1 www.google.com
sleep 60
ping -n 1 www.google.com
sleep 60
ping -n 1 www.google.com
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
that will work, if you want to ping, wait 60 seconds, send another ping etc
0
 
Maliki HassaniAuthor Commented:
Great thanks for the cool trick!
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
yes, okay, I just re-read the question, and missed "separate".
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
yes, sleep is a handy utility to have around.
0
 
Maliki HassaniAuthor Commented:
oh and what can I do from having it close the dos window after completion?
0
 
t-maxCommented:
Right, -n 60 is the number of icmp packages you send, with a one minute delay.
Because you ping localhost or even your network IP, the response time won't an issue.
Moreover, there's an advantage pinging your network IP, because you can also discover at the same time if you are having issues with your network card, something that sleep won't tell you because it's only a cpu check.
0
 
Maliki HassaniAuthor Commented:
Okay, that makes sense..  I ran it your way and it pinged 60 times. It is  great way for what you are talking about though.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
you could use a pause in the batch file?
0

Featured Post

Get Certified for a Job in Cybersecurity

Want an exciting career in an emerging field? Earn your MS in Cybersecurity and get certified in ethical hacking or computer forensic investigation. WGU’s MSCSIA degree program was designed to meet the most recent U.S. Department of Homeland Security (DHS) and NSA guidelines.  

  • 11
  • 8
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now