1.

Solve : batch that searches for "Request" in output from ping?

Answer»

I have been having to reset network hardware to fix a VPN problem daily and was looking into a way to test for connectivity across the vpn and only when the vpn is down to reset hardware to fix the handshake problem between 2 sites.

I know that I can export the output of a ping to a file and then run a program to test for instances of "Request" in the file and if "Request" is FOUND know that the connection is down and be able to then have it reboot the vpn device to fix the connection.

I am curious as to if this all could be handled within a batch, to have the batch test for matching string data in a file, and if a match is found pass a reset command that can be issued from command shell to reboot the vpn device or if this is beyond the capabilities of batch to test data within a ascii text file for a match and IF this ELSE that.

I am guessing that I will need to use C++ with system commands to CREATE the captured ping data to log file named pingvpn.log and then test for "Request" to EOF, but FIGURED I'd throw this out there to see if anyone can show me how batch could do this, if it can do it.You can parse the output of ping and perform an ACTION if a string is present

Code: [Select]ping xxx.xxx.xxx.xxx | find "Request" && (perform reset) Thanks!!!

That will work perfect. I thought there was a way to do it with batch and you refreshed me on how to accomplish it



Discussion

No Comment Found