Solved

DOS script which will ping once every 60 seconds

Posted on 2009-07-14
14
3,523 Views
Last Modified: 2012-06-27
Hi,

I would need help to create one ping at the time for every 60 seconds.

Thanks.

REgards,

rAdny
0
Comment
Question by:randybanaria
  • 5
  • 3
  • 3
  • +1
14 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 24849135

:wait
ping 127.0.0.1 -n 60 > nul

:pingit
ping somehost.somewhere.com
goto wait
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 24849156
or if you have resource kit, you can use sleep (sleep 60)

or for a vbscript method:
Dim objShell : Set objShell = CreateObject("Wscript.Shell")
 
Sub pingit()
wscript.sleep 60000
objShell.Run "ping somehost.somewhere.com"
pingit
End Sub

Open in new window

0
 
LVL 5

Expert Comment

by:Dhope
ID: 24849199
Following should do it (save it as a batch file)

:startagain
PING -n 1 machineName >>ping.log
TYPE NUL | CHOICE.COM /N /CY /TY,60 >NUL
goto startagain
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:randybanaria
ID: 24850551
To Dhope,

i tried your solution but it stops eventually.
0
 

Author Comment

by:randybanaria
ID: 24850576
i tried this solution which i found from other site.

@echo off
cls
:start
echo ping every 40 seconds
ping -n 2 X.X.37.122
sleep 40
goto start

it does the job for me.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 24850598
which is basically what I already posted...
0
 

Author Comment

by:randybanaria
ID: 24850599
this is the workaround for my previous question which i raised "cisco vpn client disconnects every 2 minutes". I'm looking for a permanent solution for vpn client disconnections.

0
 
LVL 1

Expert Comment

by:HappyJackie
ID: 24932105
::Start
ping 127.0.0.1 -n 1
sleep 60000
goto start
0
 
LVL 1

Expert Comment

by:HappyJackie
ID: 24932142
sorry previos comment was a little messed up....

Exactly how does it take before it stops pinging?
@echo off
cls
:start
ping -n 1 127.0.0.1
sleep 60000
goto start

Open in new window

0
 
LVL 1

Expert Comment

by:HappyJackie
ID: 24935968
ping -n 60 localhost

... wait's 60 seconds
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 26093547
I disagree - your posted 'solution' is basically a restatement of what I'd posted, in three different formats...
Your first response was a reply to an expert that posted after me - never acknowledging my attempts to help you, but then stating you'd resolved it with the same method described in my post...
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 26096341
Based upon my suggestion of combining my first post with the sleep utility, coupled with the author's post that this is the solution they used, I say accept http:#24849156
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now