Solved

DOS script which will ping once every 60 seconds

Posted on 2009-07-14
14
3,691 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
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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