emq-TE1/install/rebooters.sh

57 lines
1.0 KiB
Bash

#!/bin/bash
#####################################################################################################################
# rebooter general system
#####################################################################################################################
sudo cat > /usr/local/bin/rebooter1.sh <<- "EOF"
#!/bin/bash
sleep 180
while :
do
SERVER=noip.com
ping -c1 ${SERVER} > /dev/null
if [ $? != 0 ]
then
#
sudo reboot
fi
sleep 60
done
EOF
#
#####################################################################################################################
# rebooter 2
#####################################################################################################################
sudo cat > /usr/local/bin/rebooter2.sh <<- "EOF"
#!/bin/bash
sleep 180
while :
do
SERVER=noip.com
ping -c1 ${SERVER} > /dev/null
if [ $? != 0 ]
then
#
sudo reboot
fi
sleep 60
done
EOF
#
#########
sudo chmod +x /usr/local/bin/rebooter*