Fixed CheckDiskSpace compat on CentOS 5
This commit is contained in:
parent
cafbf43222
commit
f6682dabf6
|
@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
||||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=1.2-beta3
|
PROGRAM_VERSION=1.2-beta3
|
||||||
PROGRAM_BUILD=2016111704
|
PROGRAM_BUILD=2016111801
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
# Execution order #__WITH_PARANOIA_DEBUG
|
# Execution order #__WITH_PARANOIA_DEBUG
|
||||||
|
@ -284,8 +284,16 @@ function _CheckDiskSpaceLocal {
|
||||||
|
|
||||||
Logger "Checking minimum disk space in [$replica_path]." "NOTICE"
|
Logger "Checking minimum disk space in [$replica_path]." "NOTICE"
|
||||||
|
|
||||||
|
# Check for -P portability switch
|
||||||
|
if df -P; then
|
||||||
|
diskSpace=$(df -P "$replica_path" | tail -1 | awk '{print $4}')
|
||||||
|
else
|
||||||
diskSpace=$(df "$replica_path" | tail -1 | awk '{print $4}')
|
diskSpace=$(df "$replica_path" | tail -1 | awk '{print $4}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
Logger "Cannot get free space." "ERROR"
|
||||||
|
else
|
||||||
# Ugly fix for df in some busybox environments that can only show human formats
|
# Ugly fix for df in some busybox environments that can only show human formats
|
||||||
if [ $(IsInteger $diskSpace) -eq 0 ]; then
|
if [ $(IsInteger $diskSpace) -eq 0 ]; then
|
||||||
diskSpace=$(HumanToNumeric $diskSpace)
|
diskSpace=$(HumanToNumeric $diskSpace)
|
||||||
|
@ -294,6 +302,7 @@ function _CheckDiskSpaceLocal {
|
||||||
if [ $diskSpace -lt $MINIMUM_SPACE ]; then
|
if [ $diskSpace -lt $MINIMUM_SPACE ]; then
|
||||||
Logger "There is not enough free space on replica [$replica_path] ($diskSpace KB)." "WARN"
|
Logger "There is not enough free space on replica [$replica_path] ($diskSpace KB)." "WARN"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _CheckDiskSpaceRemote {
|
function _CheckDiskSpaceRemote {
|
||||||
|
|
Loading…
Reference in New Issue