Skip to main content

🔔 Low Space

Script

#!/bin/bash

mingigs=20
avail=$(df | awk '$6 == "/" && $4 < '$mingigs' * 1024*1024 { print $4/1024/1024 }')

if [ -n "$avail" ]; then
  curl \
      -H "Title: Low Disk Space" \
      -H "Priority: urgent" \
      -H "Tags: warning,cd" \
      -d "Hello TTBB! Only $avail GB available on the root disk. Better clean that up." \
      https://notify.boreux.work/raspberrypi?auth=<TOKEN>
fi

Cron

0  *    * * *   root    /bin/bash /root/ntfy/low-disk-space.sh