X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=dsa-nagios-nrpe-config%2Fdsa-update-apt-status;h=47c7e7ad723bb72c15b2a7d9e30871102ee67ac2;hb=e49f10c8c838e9d2cc817515b155c5ca4e127eb7;hp=685f96608a48d1867eb0661de5b774017962d533;hpb=f6b717ee13c473194f6694efff294ccb7d80975d;p=mirror%2Fdsa-nagios.git diff --git a/dsa-nagios-nrpe-config/dsa-update-apt-status b/dsa-nagios-nrpe-config/dsa-update-apt-status index 685f966..47c7e7a 100755 --- a/dsa-nagios-nrpe-config/dsa-update-apt-status +++ b/dsa-nagios-nrpe-config/dsa-update-apt-status @@ -3,9 +3,12 @@ UPDATE_RUNS=3 STATUS=/var/cache/dsa/nagios/apt +# sleep if called non-interactively if [ -z "$TERM" -o "$TERM" = "dumb" ]; then sleep $(( $RANDOM % 7200 )) fi + +# run apt-get update, retry a few times if it fails count=0 while [ "$count" -lt "$UPDATE_RUNS" ]; do apt-get update -qq @@ -19,6 +22,7 @@ if [ "$count" -ge "$UPDATE_RUNS" ]; then exit 1 fi +# run the apt check itself tmp=`tempfile` trap "rm -f '$tmp'" exit /usr/share/dsa/apt-status-check --noupdate --timeout=600 > "$tmp"