19 lines
641 B
Bash
Executable File
19 lines
641 B
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
source $(dirname $0)/FunctionOutput
|
|
|
|
Part="$(echo $1 | cut -d"|" -f1)"
|
|
Min="$(echo $1 | cut -d"|" -f2)"
|
|
Max="$(echo $1 | cut -d"|" -f3)"
|
|
|
|
[[ -z ${Part} ]] && Exit "5|no argument"
|
|
[[ ! -d ${Part} ]] && Exit "2|Part $Part don't exist"
|
|
[[ -z $(mount | grep -w ${Part}) ]] && Exit "2|$Part is not a partition"
|
|
|
|
Size=$(df -h ${Part} | grep -v Filesystem | awk '{print $5}' | sed "s#%##g")
|
|
|
|
[[ ${Size} -lt ${Min} ]] && Exit "0|Part $Part is under ${Min}% : ${Size}"
|
|
[[ ${Size} -gt ${Max} ]] && Exit "2|Part $Part is over ${Max}% : ${Size}"
|
|
[[ ${Size} -gt ${Min} ]] && Exit "1|Part $Part is between ${Min}% and ${Max}% : ${Size}"
|