Files
ServerManagementUtils/check-disk-usage.sh
T
2025-06-28 13:38:21 +02:00

19 lines
405 B
Bash

#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "${SCRIPT_DIR}/logging.sh"
LOGFILE=/var/log/disk_usage.log
touch "$LOGFILE"
chmod 644 "$LOGFILE"
for i in {1..6}; do
timestamp=$(GetTimestamp)
df --output=target,used,size -B1 \
| tail -n +2 \
| while read -r mount used total; do
echo "$timestamp $mount $used $total" >> "$LOGFILE"
done
sleep 10
done