Skip to content

Instantly share code, notes, and snippets.

@godie007
Created May 29, 2019 18:46
Show Gist options
  • Save godie007/591c21577778fa385ad43e353bbad809 to your computer and use it in GitHub Desktop.
Save godie007/591c21577778fa385ad43e353bbad809 to your computer and use it in GitHub Desktop.
Reiniciar pm2 cuando se caiga el internet
#!/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