iankelling.org
/
git
/
distro-setup
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
various improvements
[distro-setup]
/
system-status
diff --git
a/system-status
b/system-status
index f39f03176fdae290843d45ea851641ade5b21056..49f734a63243aee83d33f3a641583e5b53231d8c 100755
(executable)
--- a/
system-status
+++ b/
system-status
@@
-6,45
+6,43
@@
if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
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
-
+source /a/bin/errhandle/err
status_file=/dev/shm/iank-status
shopt -s nullglob
shopt -s dotglob
status_file=/dev/shm/iank-status
shopt -s nullglob
shopt -s dotglob
-lo() { /usr/local/bin/log-once
-1
"$@"; }
+lo() { /usr/local/bin/log-once "$@"; }
write-status() {
chars=()
glob=(/nocow/btrfs-stale/*)
write-status() {
chars=()
glob=(/nocow/btrfs-stale/*)
- if [[ -e $
glob ]]
; then
+ if [[ -e $
{glob[0]} ]]
; then
chars+=("STALE!")
fi
glob=(/m/md/bounces/new/*)
chars+=("STALE!")
fi
glob=(/m/md/bounces/new/*)
- if [[ -e $
glob
]]; then
+ if [[ -e $
{glob[0]}
]]; then
chars+=("BOUNCE!")
chars+=("BOUNCE!")
- lo bounce "message in /m/md/bounces/new"
+ lo
-1
bounce "message in /m/md/bounces/new"
fi
glob=(/m/md/alerts/new/* /m/md/alerts/cur/*)
fi
glob=(/m/md/alerts/new/* /m/md/alerts/cur/*)
- if [[ -e $
glob
]]; then
+ if [[ -e $
{glob[0]}
]]; then
chars+=("ALERT!")
fi
if [[ -e /nocow/user/mailtest-failure ]]; then
chars+=("MAILPING!")
chars+=("ALERT!")
fi
if [[ -e /nocow/user/mailtest-failure ]]; then
chars+=("MAILPING!")
- lo mailping "mailtest-check didnt see mail from send-test-forward"
fi
if [[ -s /var/log/exim4/paniclog ]]; then
chars+=("PANIC!")
fi
if [[ -s /var/log/exim4/paniclog ]]; then
chars+=("PANIC!")
- tail /var/log/exim4/paniclog | lo paniclog
+ tail /var/log/exim4/paniclog | lo
-1
paniclog
fi
source /a/bin/bash_unpublished/source-state
fi
source /a/bin/bash_unpublished/source-state
- if [[ $MAIL_HOST ==
$HOSTNAME
]]; then
+ if [[ $MAIL_HOST ==
"$HOSTNAME"
]]; then
if [[ $(systemctl is-active btrbk.timer) != active ]]; then
if [[ $(systemctl is-active btrbk.timer) != active ]]; then
- chars+=("BTRBK-TIMER!")
+ chars+=("BTRBK.TIMER!")
+ lo -60 btrbk.timer "btrbk.timer not enabled"
fi
## check if last snapshot was within an hour
fi
## check if last snapshot was within an hour
@@
-61,18
+59,19
@@
write-status() {
done
if (( maxtime < now - 60*60 )); then
chars+=("OLD-SNAPSHOT!")
done
if (( maxtime < now - 60*60 )); then
chars+=("OLD-SNAPSHOT!")
+ lo -1 old-snapshot "/o snapshot older than 1 hour"
fi
fi
cat /a/bin/bash_unpublished/source-state >$status_file
fi
fi
cat /a/bin/bash_unpublished/source-state >$status_file
- if [[ $
chars
]]; then
+ if [[ $
{chars[*]}
]]; then
echo "ps_char=\"${chars[*]} \$ps_char\"" >>$status_file
fi
}
write-status
echo "ps_char=\"${chars[*]} \$ps_char\"" >>$status_file
fi
}
write-status
-if [[ $
@
]]; then
+if [[ $
1
]]; then
cat $status_file
exit 0
fi
cat $status_file
exit 0
fi