From 7a7a8ab3902d3b5604530aebe26afdc01149e8af Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Mon, 1 Jul 2024 08:50:37 +0200 Subject: [PATCH] Add share/scripts/log-space.sh --- share/scripts/log-space.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 share/scripts/log-space.sh diff --git a/share/scripts/log-space.sh b/share/scripts/log-space.sh new file mode 100644 index 0000000..8410f83 --- /dev/null +++ b/share/scripts/log-space.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +LOG_DIR="/wttr.in/log" +LOG_FILE="$LOG_DIR/diskspace.log" + +DISK=/wttr.in + +log() { + mkdir -p "$LOG_DIR" + + echo "$(date +"[%Y-%m-%d %H:%M:%S]") $*" | tee -a "$LOG_FILE" +} + +log $(df -k "$DISK" | tail -1 | awk '{print $4}')