+#!/bin/bash
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+
+f=/dev/shm/iank-status
+
+write-status() {
+ chars=()
+
+ if test -e /nocow/btrfs-stale/*; then
+ chars+=("STALE!")
+ fi
+ if test -e /m/md/bounces/new/*; then
+ chars+=("BOUNCE!")
+ fi
+ if [[ -e /nocow/user/mailtest-failure ]]; then
+ chars+=("MAILPING!")
+ fi
+ if [[ -s /var/log/exim4/paniclog ]]; then
+ chars+=("PANIC!")
+ fi
+
+ cat /a/bin/bash_unpublished/source-state >$f
+
+ if [[ $chars ]]; then
+ echo "ps_char=\"${chars[*]} \$ps_char\"" >>$f
+ fi
+}
+write-status
+if [[ $@ ]]; then
+ exit 0
+fi
+for ((i=1; i<=3; i++)); do
+ sleep 15
+ write-status
+done