Created
May 29, 2019 18:46
-
-
Save godie007/591c21577778fa385ad43e353bbad809 to your computer and use it in GitHub Desktop.
Reiniciar pm2 cuando se caiga el internet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
i=0 | |
while true; | |
do | |
if ping -c 1 google.com &> /dev/null | |
then | |
echo "Conectado" | |
else | |
echo "Desconectado" | |
echo $i | |
if [[ "$i" == '5' ]]; then | |
/home/pi/.nvm/versions/node/v8.11.4/bin/pm2 restart servidor | |
echo "Se reinicia pm2" | |
fi | |
((i++)) | |
fi | |
sleep 1 | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment