BASH 33
Df-check.sh Guest on 3rd July 2020 12:13:26 PM
  1. #!/bin/bash
  2. # Tested Under FreeBSD and OS X
  3.  
  4. FS="/usr"
  5. THRESHOLD=90
  6. OUTPUT=($(LC_ALL=C df -P ${FS}))
  7. CURRENT=$(echo ${OUTPUT[11]} | sed 's/%//')
  8. [ $CURRENT -gt $THRESHOLD ] && /usr/bin/zenity  --warning  --text="The disk $FS ($CURRENT% used) is almost full. Delete some files or add a new disk." --title="df Warning"

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.