You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wttr.in/share/scripts/log-space.sh

15 lines
242 B

#!/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}')