Scheduled Task that will conditionally launch a .bat file and then stop running
Posted on 2010-08-21
Below novice level programmer, mostly cut and paste. I'm trying to create a scheduled task that will ping an IP every 5 minutes and launch a .bat file when the ping fails. I was able to copy something that works great, except I can't figure out how to get it to stop running once it launches the .bat file. I used the following as a .bat and just set it to run Daily, and then every 5 minutes under the advance tab. If someone can show me a better way to do this with my limited knowledge, I'd appreciate it. Again, ideally this would trigger the .bat file when the ping failed, and then stop the job from running so it would try to launch it again every 5 minutes that the server is down. Thanks much.
for /f "delims=." %%I in ('ping -n 1 10.0.0.75') do if "%%I"=="Request timed out" (c:\Scenario2-Principal_SQL01_Failure.bat)