File size: 436 Bytes
2ae6691
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
# Logs free space on /fsx every 5 minutes; readings below LOW_GB are marked LOW.
# Start: nohup ./diskwatch.sh >> logs/disk.log 2>&1 &    Stop: pkill -f diskwatch.sh
cd /fsx/ajay-stu/AR
LOW_GB=300
while true; do
  free=$(df -BG --output=avail /fsx | tail -1 | tr -dc '0-9')    # free space in GB
  tag=""; [ "$free" -lt $LOW_GB ] && tag="  <-- LOW"
  echo "$(date -u '+%m-%d %H:%M') UTC  free=${free}G$tag"
  sleep 300
done