• # cron

    Posté par (site web personnel, Mastodon) . En réponse au message script simple!. Évalué à 4. Dernière modification le 14 juin 2018 à 23:47.

    Je ne ferai pas un processus continu; je ferai un script lancé toutes les 5min via cron:

    */5 * * * * root /chemin/vers/le/script

    Le script:

    #!/bin/bash
    ping -w5 -c4 8.8.8.8 > /tmp/pingu
    if grep " 100% packet loss\|Time to live exceeded\|Destination Host Unreachable" /tmp/pingu >/dev/null 2>&1
    then
     service network-manager restart
    fi
    rm -f /tmp/pingu

    La gelée de coings est une chose à ne pas avaler de travers.