This shows you the differences between two versions of the page.
| — |
kurs:mydf.sh [2014/09/10 21:22] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | <code> | ||
| + | #!/bin/bash | ||
| + | |||
| + | |||
| + | |||
| + | ## IFS=$'\n' | ||
| + | HEAD=0 | ||
| + | |||
| + | df -k | while read FS BLOCKS USED AVAILABLE USEP MOUNT | ||
| + | do | ||
| + | if [ $HEAD -ne 1 ]; then | ||
| + | HEAD=1 | ||
| + | continue | ||
| + | fi | ||
| + | USED_PROZ=` echo "scale=3; $USED * 100 / $AVAILABLE" | bc ` | ||
| + | ## echo -n "$MOUNT $USED_PROZ" | ||
| + | USEP=`echo $USEP | sed 's/%//' ` | ||
| + | printf "% 20s [%02.02f] [%02g]\n" $MOUNT $USED_PROZ $USEP | ||
| + | if [ $USEP -gt 90 ]; then | ||
| + | echo ACHTUNG | ||
| + | fi | ||
| + | done | ||
| + | </code> | ||