Closed zcpnate closed 2 weeks ago
Thanks @zcpnate !
Brilliant idea. Can you test this script for me on you setup?
#!/bin/bash
#
# Function to test an IP to see if it returns a ping
function test_ip() {
local IP=$1
if [ -z "${IP}" ]; then
return 1
fi
if curl -k --head --connect-timeout 1 --silent https://${IP} > /dev/null 2>&1; then
return 0
else
return 1
fi
}
# check IP and if it returns a ping print "IP is up" else print "IP is down"
echo "Positive test"
if test_ip "192.168.91.1" ; then
echo "IP is up"
else
echo "IP is down"
fi
echo "Negative test"
if test_ip "192.168.91.2" ; then
echo "IP is up"
else
echo "IP is down"
fi
Running on synology with PW3, setup fails due to non-root user not having ping permissions
sudo chmod +s /bin/ping
will fixmight be better to use curl for the pw3 check for synology users