#!/bin/bash . /etc/print-status.conf { printf 'Status Of %s\n' \ "$(uname -n | cut -d. -f1)" if [ "${#watch_dirs[@]}" -gt 0 ]; then printf '%s\n' \ '

Partitions

' for dir in "${watch_dirs[@]}"; do { du -sxh "${dir}" df -h "${dir}" \ | sed '1d' } \ | tr '\n' ' ' printf '\n' done \ | awk '{ print $2 ": " $1 "B (partition: " $5 "B of " $4 "B used, " $6 "B free)
" }' fi find /dev/mapper -mindepth 1 -maxdepth 1 \( -name 'leg*' -o -name 'foot*' \) -printf '%f\n' \ | sort -u \ | xargs -rn1 cryptsetup status \ | sed ' s/^\s\+// s/\s\+$// \,^/dev/mapper/, !d / is active and is in use\.$/ { s,.*,\0, b } / is active\.$/ { s,.*,\0, b } s,.*,\0, ' \ | sed ' s/$/
/ 1i

Crypt Devices

' if [ -f /proc/mdstat ]; then cat <Software RAIDs EOF { sed -n ' /^Personalities/d /^\S/ { N s/^\(\S\+\)\s*:\s*\(\S\+\)\s.*\n\s*\([0-9]\)/\1: \2 \3/ T p } s/^\s\+\(\[[^][]\+]\)\s\+\(\S\+\)\s\+=\s\+\(\S\+\)\s\+\S\+\s\+\(finish=\S\+\)\s.*$/\2 \3 \1 \4/ T p ' /proc/mdstat \ | sed ' s/^md\([0-9]\+\):/\1 \0/ ' \ | sort -k1n,1 \ | sed ' s/^\([0-9]\+\) md\1:/md\1:/ ' \ | while read -r line; do if [ -z "${line%%* finish=*min*}" ]; then duration="${line##* finish=}" duration="${duration%%min*}" time=$( date +'%F %T' -d@$(( $(date +%s) + $(echo "60 * ${duration}" | bc -l | sed 's/\..*$//') )) ) printf '%s (%s)\n' "${line}" "${time}" else printf '%s\n' "${line}" fi done \ | sed ' s,^\(.* \)active \(.*\[U\+\]\)$,\1\2, t s,^\(re\(shape\|covery\|sync\) \S\+\) \[\(\S*\)>\(\.*\)\] \(\S\+\s\+\S\+\s\+\S\+\)$,\1 [\3\>\4] \5, t s,^\(.* \)active \(.*\)$,\1\2, t s,^.*$,\0, ' find /sys/block/ \ -mindepth 1 \ -maxdepth 1 \ -name 'md*' \ -exec sh -c 'test -f "{}/md/mismatch_cnt"' \; \ -printf '%f: ' \ -exec cat '{}/md/mismatch_cnt' \; \ | sed 's@^md\([0-9]\+\): @\1 \0@' \ | sort -k1n,1 \ | sed 's@^\S\+ @@' \ | sed ' s@^\S\+: 0$@\0@ t s@^.*$@\0@ ' } \ | sed ' s/$/
/ ' fi if command -v ssacli >/dev/null 2>&1; then cat <Hardware RAIDs EOF ssacli controller all show \ | awk '$1 == "Smart" && $2 == "Array" {print $6}' \ | xargs -rI __ ssacli ctrl slot=__ ld all show \ | sed ' s/^\s\+// s/\s\+$// /^$/d /^logicaldrive/ !b / OK)$/ { s,.*,\0, b } s,.*,\0, ' \ | sed ' s/$/
/ ' fi cat <Backups EOF last-backups \ | sed ' /VERALTET\|LEER/ ! s/^/ok/ ' \ | awk '{ print "" }' \ | sed ' s/^\(,,g b } s,,,g ' cat < EOF if [ -f "${http_dir}/index.html" ]; then cat < EOF OUTPUT="${http_dir}/index.html" backup-progress \ | tr -d '()' \ | awk '{print ""}' cat < EOF fi cat <Network

Status

EOF printf 'Bericht erstellt am %s um %s Uhr (%s).
\n' \ "$( date '+%F' )" \ "$( date '+%H:%M:%S' )" \ "$( date '+%Z' )" cat < EOF } | \ if mountpoint -q "${http_dir}"; then sponge "${http_dir}/index.html" else cat fi
StatusNameLetztes erfolgreiches Backup
" $1 "" $2 "" $3 "
[^<>]*\)_laeuft/\1 (l\äuft)/ /^
ok\( [^<>]\+\)\?\([^<>]\+\)\1\([^<>]\+\)\1
NameFortschrittbisherige Größe
" $1 "" $2 " " $3 "" $4 " " $5 "