Skip to content

Instantly share code, notes, and snippets.

@xorenio
Created February 24, 2017 10:28
Show Gist options
  • Save xorenio/566eda2b9931d2a0478c3ab66bd4e458 to your computer and use it in GitHub Desktop.
Save xorenio/566eda2b9931d2a0478c3ab66bd4e458 to your computer and use it in GitHub Desktop.
Bash available space check
#!/bin/bash
# for file sizes
# 19456000 = 19GB
# Random find on hard drive might not work
SPACE= df -P . | tail -1 | awk 'CHECK=$4';
S=df -P $PWD | awk 'NR==2{print $4}'
echo $S;
#echo $SPACE;
#SPACE2='100';
if [ $SPACE -lt '19372299' ]; then
echo '';
echo 'We are running out of space under ';
else
echo 'we all good on space';
fi
exit 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment