1/8/2018
Posted by 
Batch File Send Email If Ping Fails Rating: 3,5/5 9874votes

If the ping fails, write the date and time to a file. Batch Script - Ping Address - Write to file if failure multiple. Windows Batch File Ping an IP and. Dec 05, 2010 Script to ping an IP and send an email when ping returns consecutive timeouts. Batch file would work as well. Rem Runs Ping. FAILED PING!!!'

Email

Can i get a bat file to email me if it fails? Also, is there and easy way to schedule a bat file to run every night at a certain time? Im trying to setup Jenkins, scheduler, here, but, its not going well. The commands im feeding it work in the cmd window, but, they dont work in Jenkins.

So im thinking, ok nevermind jenkins, why not just create a bat file. The only prob with that is how to get it to kick off, and how to get it to alert users to success or failure of the build. Kind regards, brian.

If it fails it can not report failure, so you need a 2nd process which could be a different batch file that performs a checkup on the batch that is to be monitored for failure and performs the e-mail through 3rd party software that allows for e-mail sent from command line. I made a C++ program that checked a Grupa Zana Diskografija. Routine1_log.txt file for the date. The batch process started at 12:15am and so if it completed successfully, (got to complete the entire instruction set of the batch file), at the end of this batch file I had a echo.%date%>Routine1_log.txt to pass the date to this log file. The C++ program I wrote would run at 4am and test to make sure that todays date matched that of the Routine1_log.txt file. If it was a match then no e-mail alert. If there was a mismatch, then I would be sent an e-mail.

I then was able to check my e-mail first thing in the morning and see what processes failed if any did. It was a very rare occurrance to have a batch malfunction or fail to complete, but it happened 2 times in 5 years. Not to sidetrack, but I ended up creating a monitoring system that would give me a phone call and play prerecorded messages to myself as to the problems so I knew where the problem was and was able to get to the site and already know what I was up against before getting there. In addition to programs I wrote in C++, I used a cool software tool called Alert Ping Pro and bought a license of it. Figured I'd share this in case you need additional monitoring such as to make sure network attached devices are live as well as I also had 4 other locations bridged to the central hub and I could tell when a site went offline from the central hub location.

I work in a small IT department that has multiple users in other external offices and have made a basic (Windows) PING command batch script that pings each office to check they are online. I simply run the.bat file and leave it in the corner of my screen. If a ping fails it turns the background red, if it works it stays blue. Here is the content: @echo off COLOR 97:start echo EXTERNAL CHECK PING www.google.com IF%ERRORLEVEL% EQU 0 COLOR 97 IF%ERRORLEVEL% EQU 1 COLOR 47 echo SITE A CHECK PING x.x.x.x IF%ERRORLEVEL% EQU 0 COLOR 97 IF%ERRORLEVEL% EQU 1 COLOR 47 echo SITE B CHECK PING x.x.x.x IF%ERRORLEVEL% EQU 0 COLOR 97 IF%ERRORLEVEL% EQU 1 COLOR 47 echo SITE C CHECK PING x.x.x.x IF%ERRORLEVEL% EQU 0 COLOR 97 IF%ERRORLEVEL% EQU 1 COLOR 47 echo SITE D CHECK PING x.x.x.x IF%ERRORLEVEL% EQU 0 COLOR 97 IF%ERRORLEVEL% EQU 1 COLOR 47 goto start I am pretty new to scripting so apologies for any stupid errors. If anyone has any suggestions to improve it I would welcome them.