I have a disk script like this:
#!/bin/bash
filesys=(
/
)
[ -f "$(pwd)/filesys.conf" ] && filesys=($(<$(pwd)/filesys.conf))
date=$(date +"%d\/%m\/%Y")
df -P "${filesys[@]}" |
sed -ne 's/^.* \([0-9]\+\)% \(.*\)$/'$date', \2, \1%/p' > disk.log
I have filesys.conf for work which filesystem:
/
/run
And this is output (disk.log):
23/05/2016, /, 78%
23/05/2016, /run, 0%
Question:
I need filesys.conf because server filesystems always change, conf file easy for me. But I need to add usage parameter in filesys.conf too like this:
/,90
/run,99
If /
usage greater than 90, /run
usage greater than 99, write to log file.
How can I do this?