2
0
mirror of https://github.com/deajan/osync synced 2024-11-15 12:12:56 +00:00

Fixed CheckDiskSpace compat on CentOS 5

This commit is contained in:
deajan 2016-11-18 12:49:48 +01:00
parent cafbf43222
commit f6682dabf6

View File

@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.2-beta3
PROGRAM_BUILD=2016111704
PROGRAM_BUILD=2016111801
IS_STABLE=no
# Execution order #__WITH_PARANOIA_DEBUG
@ -284,8 +284,16 @@ function _CheckDiskSpaceLocal {
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}')
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
if [ $(IsInteger $diskSpace) -eq 0 ]; then
diskSpace=$(HumanToNumeric $diskSpace)
@ -294,6 +302,7 @@ function _CheckDiskSpaceLocal {
if [ $diskSpace -lt $MINIMUM_SPACE ]; then
Logger "There is not enough free space on replica [$replica_path] ($diskSpace KB)." "WARN"
fi
fi
}
function _CheckDiskSpaceRemote {