4 STATUS=/var/cache/dsa/nagios/apt
6 # sleep if called non-interactively
7 if [ -z "$TERM" -o "$TERM" = "dumb" ]; then
8 sleep $(( $RANDOM % 7200 ))
11 # run apt-get update, retry a few times if it fails
13 while [ "$count" -lt "$UPDATE_RUNS" ]; do
15 if [ "$?" = "0" ]; then break; fi
16 sleep $(( $RANDOM % 600 ))
17 count="$(( $count + 1 ))"
19 if [ "$count" -ge "$UPDATE_RUNS" ]; then
21 echo "apt-get update failed") > "$STATUS"
25 # run the apt check itself
27 trap "rm -f '$tmp'" exit
28 /usr/share/dsa/apt-status-check --noupdate --timeout=600 > "$tmp"
44 (echo "$st"; cat "$tmp") > "$STATUS"