mostly a bunch of fixes
[distro-setup] / check-stale-alerts
1 #!/bin/bash
2
3
4 if [[ ! -e /dev/shm/iank-status ]]; then
5 exit 0
6 fi
7 eval $(< /dev/shm/iank-status)
8
9 dirs=()
10 for d in /var/local/cron-errors /home/iank/cron-errors /sysd-mail-once-state; do
11 if [[ -e $d ]]; then
12 dirs+=($d)
13 fi
14 done
15 if (( ${#dirs[@]} >= 1 )); then
16 out=$(find ${dirs[@]} -type f)
17 fi
18 if [[ $out ]]; then
19 echo HOSTNAME: $HOSTNAME
20 printf "%s\n" "$out"
21 fi
22 if [[ $HOSTNAME != "$MAIL_HOST" ]]; then
23 exit 0
24 fi
25 for h in {li,bk,je}.b8.nz; do
26 out=$(ssh $h find /m/md/bounces/new /var/local/cron-errors /home/iank/cron-errors /sysd-mail-once-state -type f)
27 if [[ $out ]]; then
28 echo $h:
29 printf "%s\n" "$out"
30 fi
31 done
32
33 # for .prom.$PID files, they will naturally exist when
34 # scripts like system-status get killed on reboot.
35 # Just clean them up here.
36 find /var/lib/prometheus/node-exporter -name '*[0-9]' -type f -mtime 9 -delete