-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
# From http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_03.html | ||
# Regarding https://github.com/sdrausty/TermuxArch/issues/37 | ||
# This script does a very simple test for checking disk space. | ||
|
||
space=`df -h | awk '{print $5}' | grep % | grep -v Use | sort -n | tail -1 | cut -d "%" -f1 -` | ||
|
||
case $space in | ||
[1-6]*) | ||
Message="All is quiet." | ||
;; | ||
[7-8]*) | ||
Message="Start thinking about cleaning out some stuff. There's a partition that is $space % full." | ||
;; | ||
9[1-8]) | ||
Message="Better hurry with that new disk... One partition is $space % full." | ||
;; | ||
99) | ||
Message="I'm drowning here! There's a partition at $space %!" | ||
;; | ||
*) | ||
Message="I seem to be running with an nonexistent amount of disk space..." | ||
;; | ||
esac | ||
|
||
echo $Message | mail -s "disk report `date`" anny |