X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=system-status;h=d6874e14ddfa39bbbaf93f8ceea86e7a96aa1d5b;hb=103a2e153f844343c359882079936b2521c82f15;hp=3ccde7c023e1fb06017a24b5a9c3d7a627d4cc6a;hpb=56c55d8e02cdd6ec67d2fe53cc03785d8876442e;p=distro-setup diff --git a/system-status b/system-status index 3ccde7c..d6874e1 100755 --- a/system-status +++ b/system-status @@ -46,6 +46,12 @@ loday() { /usr/local/bin/log-once "$@" | ifne mail -s "$HOSTNAME: system-status $2" daylert@iankelling.org fi } +# rm glob +rmg() { + if (( $# )); then + rm -f "$@" + fi +} # todo, consider migrating some of these alerts into prometheus write-status() { @@ -94,6 +100,24 @@ write-status() { esac + # this section copied from servicepid() + unit=exim4 + pid=$(systemctl show --property MainPID --value $unit ||:) + case $pid in + [1-9]*) : ;; + *) + dir=/sys/fs/cgroup/system.slice + if [[ ! -d $dir ]]; then + dir=/sys/fs/cgroup/systemd/system.slice + fi; + pid=$(head -n1 $dir/${unit%.service}.service/cgroup.procs ||:) + ;; + esac + if [[ ! $pid ]]; then + chars+=(EXIM) + fi + + if [[ -e /a/bin/bash_unpublished/source-state ]]; then # /a gets remounted due to btrbk, ignore error code for file doesnt exist source /a/bin/bash_unpublished/source-state || [[ $? == 1 ]] @@ -137,7 +161,7 @@ write-status() { # allow failure in case there are no snapshots yet. # shellcheck disable=SC2012 shopt -u nullglob - files=(/mnt/root/btrbk/$vol.20*) + files=(/mnt/o/btrbk/$vol.20*) shopt -s nullglob snaps=() if (( ${#files[@]} )); then @@ -177,7 +201,10 @@ write-status() { # fi # fi # fi - + else # end if $MAIL_HOST + rmg /home/iank/cron-errors/bounce* \ + /home/iank/cron-errors/btrbk.timer* \ + /home/iank/cron-errors/old-snapshot* fi if ip l show tunfsf &>/dev/null; then @@ -200,7 +227,7 @@ write-status() { if [[ ! $last_emacs_check || $emacsfiles ]] || (( last_emacs_check < EPOCHSECONDS - 300 )); then if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then # i dun care if this fails - emacsfiles="$(timeout 1 emacsclient --eval "$elisp"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//' ||:)" + emacsfiles="$(timeout 1 emacsclient -a /usr/bin/true --eval "$elisp" 2>/dev/null | sed '/^"nil"$/d;s/^"(/E: /;s/)"$//' ||:)" if [[ $emacsfiles ]]; then chars+=("$emacsfiles") fi @@ -233,6 +260,9 @@ write-status() { $MAIL_HOST) p $qmsg | loday -120 qlen ;; + *) + rmg /home/iank/cron-errors/qlen* + ;; esac begin=false