mirror of
https://github.com/deajan/obackup.git
synced 2025-02-06 03:13:49 +01:00
Backported some fixes from Osync
This commit is contained in:
parent
45633d1362
commit
a96707d17c
@ -22,6 +22,12 @@ UNDER WORK
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
- Create local subdirectories if not exist before running rsync (rsync doesn't handle mkdir -p)
|
||||||
|
- Backported some fixes from Osync
|
||||||
|
- Lowered sleep time between commands
|
||||||
|
- Lowered debug sleep times
|
||||||
|
- Fixed a bug with exclude pattern globbing preventing multiple exludes
|
||||||
|
- Lowered default compression level for email alerts (for low end systems)
|
||||||
- Prevent exclude pattern globbing before the pattern reaches the rsync cmd
|
- Prevent exclude pattern globbing before the pattern reaches the rsync cmd
|
||||||
- Fixed some typos with ported code from osync rendering stats and partial downloads unusable
|
- Fixed some typos with ported code from osync rendering stats and partial downloads unusable
|
||||||
- Added delete on destination option for files that vanished from source
|
- Added delete on destination option for files that vanished from source
|
||||||
|
66
obackup.sh
66
obackup.sh
@ -4,8 +4,8 @@
|
|||||||
###### (L) 2013-2015 by Orsiris "Ozy" de Jong (www.netpower.fr)
|
###### (L) 2013-2015 by Orsiris "Ozy" de Jong (www.netpower.fr)
|
||||||
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
|
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=1.84RC4
|
PROGRAM_VERSION=1.9pre
|
||||||
PROGRAM_BUILD=1202201501
|
PROGRAM_BUILD=0304201501
|
||||||
|
|
||||||
## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode
|
## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode
|
||||||
if ! type -p "$BASH" > /dev/null
|
if ! type -p "$BASH" > /dev/null
|
||||||
@ -18,9 +18,9 @@ fi
|
|||||||
if [ ! "$DEBUG" == "yes" ]
|
if [ ! "$DEBUG" == "yes" ]
|
||||||
then
|
then
|
||||||
DEBUG=no
|
DEBUG=no
|
||||||
SLEEP_TIME=1
|
SLEEP_TIME=.1
|
||||||
else
|
else
|
||||||
SLEEP_TIME=10
|
SLEEP_TIME=3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SCRIPT_PID=$$
|
SCRIPT_PID=$$
|
||||||
@ -37,10 +37,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
## Default directory where to store run files
|
## Default directory where to store run files
|
||||||
if [ -w /dev/shm ]
|
if [ -w /tmp ]
|
||||||
then
|
|
||||||
RUN_DIR=/dev/shm
|
|
||||||
elif [ -w /tmp ]
|
|
||||||
then
|
then
|
||||||
RUN_DIR=/tmp
|
RUN_DIR=/tmp
|
||||||
elif [ -w /var/tmp ]
|
elif [ -w /var/tmp ]
|
||||||
@ -202,7 +199,7 @@ function StripQuotes
|
|||||||
|
|
||||||
function EscapeSpaces
|
function EscapeSpaces
|
||||||
{
|
{
|
||||||
echo $(echo $1 | sed 's/ /\\ /g')
|
echo $(echo "$1" | sed 's/ /\\ /g')
|
||||||
}
|
}
|
||||||
|
|
||||||
function CleanUp
|
function CleanUp
|
||||||
@ -429,14 +426,14 @@ function WaitForTaskCompletion
|
|||||||
then
|
then
|
||||||
Log "Current task still running."
|
Log "Current task still running."
|
||||||
fi
|
fi
|
||||||
if [ $EXEC_TIME -gt $2 ]
|
if [ $EXEC_TIME -gt "$2" ]
|
||||||
then
|
then
|
||||||
if [ $soft_alert -eq 0 ] && [ $2 != 0 ]
|
if [ $soft_alert -eq 0 ] && [ "$2" != 0 ]
|
||||||
then
|
then
|
||||||
LogError "Max soft execution time exceeded for task."
|
LogError "Max soft execution time exceeded for task."
|
||||||
soft_alert=1
|
soft_alert=1
|
||||||
fi
|
fi
|
||||||
if [ $EXEC_TIME -gt $3 ] && [ $3 != 0 ]
|
if [ $EXEC_TIME -gt "$3" ] && [ "$3" != 0 ]
|
||||||
then
|
then
|
||||||
LogError "Max hard execution time exceeded for task. Stopping task execution."
|
LogError "Max hard execution time exceeded for task. Stopping task execution."
|
||||||
kill -s SIGTERM $1
|
kill -s SIGTERM $1
|
||||||
@ -968,18 +965,27 @@ function RsyncExcludePattern
|
|||||||
{
|
{
|
||||||
# Disable globbing so wildcards from exclusions don't get expanded
|
# Disable globbing so wildcards from exclusions don't get expanded
|
||||||
set -f
|
set -f
|
||||||
OLD_IFS=$IFS
|
rest="$RSYNC_EXCLUDE_PATTERN"
|
||||||
IFS=$PATH_SEPARATOR_CHAR
|
while [ -n "$rest" ]
|
||||||
for excludedir in $RSYNC_EXCLUDE_PATTERN
|
do
|
||||||
do
|
# Take the string until first occurence until $PATH_SEPARATOR_CHAR
|
||||||
if [ "$RSYNC_EXCLUDE" == "" ]
|
str=${rest%%;*}
|
||||||
then
|
# Handle the last case
|
||||||
RSYNC_EXCLUDE="--exclude=$(EscapeSpaces $excludedir)"
|
if [ "$rest" = "${rest/$PATH_SEPARATOR_CHAR/}" ]
|
||||||
else
|
then
|
||||||
RSYNC_EXCLUDE="$RSYNC_EXCLUDE --exclude=$(EscapeSpaces $excludedir)"
|
rest=
|
||||||
fi
|
else
|
||||||
done
|
# Cut everything before the first occurence of $PATH_SEPARATOR_CHAR
|
||||||
IFS=$OLD_IFS
|
rest=${rest#*$PATH_SEPARATOR_CHAR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$RSYNC_EXCLUDE" == "" ]
|
||||||
|
then
|
||||||
|
RSYNC_EXCLUDE="--exclude=\"$str\""
|
||||||
|
else
|
||||||
|
RSYNC_EXCLUDE="$RSYNC_EXCLUDE --exclude=\"$str\""
|
||||||
|
fi
|
||||||
|
done
|
||||||
set +f
|
set +f
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1020,11 +1026,11 @@ function Rsync
|
|||||||
RSYNC_NO_RECURSE_ARGS=""
|
RSYNC_NO_RECURSE_ARGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Directories should not be created here
|
# Creating subdirectories because rsync cannot handle mkdir -p
|
||||||
#if [ ! -d $local_file_storage_path ]
|
if [ ! -d $local_file_storage_path/$1 ]
|
||||||
#then
|
then
|
||||||
# mkdir -p "$local_file_storage_path"
|
mkdir -p "$local_file_storage_path/$1"
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
if [ "$REMOTE_BACKUP" == "yes" ]
|
if [ "$REMOTE_BACKUP" == "yes" ]
|
||||||
@ -1299,7 +1305,7 @@ function Init
|
|||||||
## Set compression executable and extension
|
## Set compression executable and extension
|
||||||
if [ "$COMPRESSION_LEVEL" == "" ]
|
if [ "$COMPRESSION_LEVEL" == "" ]
|
||||||
then
|
then
|
||||||
COMPRESSION_LEVEL=9
|
COMPRESSION_LEVEL=3
|
||||||
fi
|
fi
|
||||||
if type -p xz > /dev/null 2>&1
|
if type -p xz > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user