How to Ping an IP and run a command when ping failed?
-
Hello,
I want to ping an IP every minute and when the ping result failed run a command like this:pfSsh.php playback svc stop openvpn server 1;
pfSsh.php playback svc start openvpn server 1;Have I any chance about this?
Thanks
-
You'd do it with a shell script. Here's one I wrote years ago on Linux:
#! /bin/sh
while [ 1 ]
do
ping 99.246.124.1 -c 1 || date >> ~/log;sleep 50
doneThe commands I run on failure are date and sleep for 50 seconds.
-
This post is deleted!
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.