Solved

DOS script which will ping once every 60 seconds

Posted on 2009-07-14
14
3,295 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
 

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

21 Experts available now in Live!

Get 1:1 Help Now