#!/bin/sh
while [ 1 ]
do
ping -c5 https://google.com
if [ $? -eq 0]; then
echo Ping check ok, waiting...
else
poweroff
fi
done