diff options
author | Erich Eckner <git@eckner.net> | 2021-06-27 10:12:06 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-06-27 10:12:06 +0200 |
commit | 97bcf1689b3406f0860de018a1f9d33d99613cc8 (patch) | |
tree | 4602d884b4bbe1617c8046e87044b394083cdb20 | |
parent | 778206e94bec853345ef04e936aba33ba9573c9e (diff) | |
download | print-status-97bcf1689b3406f0860de018a1f9d33d99613cc8.tar.xz |
print-status-html: make watch_dirs optional
-rwxr-xr-x | print-status-html | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/print-status-html b/print-status-html index c82bfa0..9e67738 100755 --- a/print-status-html +++ b/print-status-html @@ -3,24 +3,29 @@ . /etc/print-status.conf { - cat <<EOF + + if [ -n "${watch_dirs[@]}" ]; then + + cat <<EOF <html><head><title>Status Of Backup Server</title></head><body> <h1>Partitions</h1> EOF - for dir in "${watch_dirs[@]}"; do - { - du -sxh "${dir}" - df -h "${dir}" \ + for dir in "${watch_dirs[@]}"; do + { + du -sxh "${dir}" + df -h "${dir}" \ | sed '1d' - } \ + } \ | tr '\n' ' ' - printf '\n' - done \ + printf '\n' + done \ | awk '{ print $2 ": " $1 "B (partition: " $5 "B of " $4 "B used, " $6 "B free)<br>" }' + fi + cat <<EOF <h1>Crypt Devices</h1> EOF |