Linux/Neorouter: watchdog for neorouter connection

PHOTO EMBED

Mon Aug 29 2022 15:35:55 GMT+0000 (UTC)

Saved by @marcopinero #bash

#!/bin/sh

#----------------------------------------------------------------
# Para que funcione colocar en /usr/local/bin:
#
#     $> sudo cp verifica_nr /usr/local/bin
#
# Dar permiso de ejecución:
#
#     $> sudo chmod +x /usr/local/bin/verifica_nr
#
# Luego se agrega en crontab (cada minuto):
#
#     $> sudo crontab -e
#     (ir al final y agregar:)
#     * * * * * /usr/local/bin/verifica_nr
#     (Guardar)
#----------------------------------------------------------------
SERVICE="nrservice"
if ps ax | grep -v grep | grep -v $0 | grep $SERVICE > /dev/null
then
    echo "$SERVICE service running, everything is fine" > /dev/null
else
    sudo service nrservice.sh restart
fi
content_copyCOPY