mirror of
https://github.com/deajan/obackup.git
synced 2024-11-15 04:03:41 +01:00
Rebuilt targets
This commit is contained in:
parent
f72d1366ff
commit
a8d5814b8f
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
###### Remote push/pull (or local) backup script for files & databases
|
###### Remote push/pull (or local) backup script for files & databases
|
||||||
PROGRAM="obackup"
|
PROGRAM="obackup"
|
||||||
AUTHOR="(C) 2013-2017 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.1-RC1
|
PROGRAM_VERSION=2.1-RC1
|
||||||
PROGRAM_BUILD=2018093003
|
PROGRAM_BUILD=2018093005
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
#### Execution order #__WITH_PARANOIA_DEBUG
|
#### Execution order #__WITH_PARANOIA_DEBUG
|
||||||
@ -4264,7 +4264,7 @@ function FilesBackup {
|
|||||||
encryptDir="$FILE_STORAGE"
|
encryptDir="$FILE_STORAGE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Beginning file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
Logger "Beginning non recursive file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
||||||
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
||||||
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" false true
|
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" false true
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -4299,7 +4299,7 @@ function FilesBackup {
|
|||||||
encryptDir="$FILE_STORAGE"
|
encryptDir="$FILE_STORAGE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Beginning file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
Logger "Beginning recursive child file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
||||||
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
||||||
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" true true
|
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" true true
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -4376,7 +4376,9 @@ function _RotateBackupsLocal {
|
|||||||
copy=$((copy-1))
|
copy=$((copy-1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# TODO: Describe new behavior: Always copy instead of move in order to make delta copies
|
||||||
# Latest file backup will not be moved if script configured for remote backup so next rsync execution will only do delta copy instead of full one
|
# Latest file backup will not be moved if script configured for remote backup so next rsync execution will only do delta copy instead of full one
|
||||||
|
# Whereas sql files will always be moved because we don't do deltas on sql files
|
||||||
if [[ $backup == *.sql.* ]]; then
|
if [[ $backup == *.sql.* ]]; then
|
||||||
cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
||||||
Logger "Launching command [$cmd]." "DEBUG"
|
Logger "Launching command [$cmd]." "DEBUG"
|
||||||
@ -4387,7 +4389,8 @@ function _RotateBackupsLocal {
|
|||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$REMOTE_OPERATION" == "yes" ]; then
|
else
|
||||||
|
#elif [ "$REMOTE_OPERATION" == "yes" ]; then
|
||||||
cmd="cp -R \"$backup\" \"$backup.$PROGRAM.1\""
|
cmd="cp -R \"$backup\" \"$backup.$PROGRAM.1\""
|
||||||
Logger "Launching command [$cmd]." "DEBUG"
|
Logger "Launching command [$cmd]." "DEBUG"
|
||||||
eval "$cmd" &
|
eval "$cmd" &
|
||||||
@ -4397,15 +4400,15 @@ function _RotateBackupsLocal {
|
|||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
#else
|
||||||
cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
# cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
||||||
Logger "Launching command [$cmd]." "DEBUG"
|
# Logger "Launching command [$cmd]." "DEBUG"
|
||||||
eval "$cmd" &
|
# eval "$cmd" &
|
||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING
|
# ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
if [ $? -ne 0 ]; then
|
# if [ $? -ne 0 ]; then
|
||||||
Logger "Cannot move [$backup] to [$backup.$PROGRAM.1]." "ERROR"
|
# Logger "Cannot move [$backup] to [$backup.$PROGRAM.1]." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
# _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
fi
|
# fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
31
obackup.sh
31
obackup.sh
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
###### Remote push/pull (or local) backup script for files & databases
|
###### Remote push/pull (or local) backup script for files & databases
|
||||||
PROGRAM="obackup"
|
PROGRAM="obackup"
|
||||||
AUTHOR="(C) 2013-2017 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.1-RC1
|
PROGRAM_VERSION=2.1-RC1
|
||||||
PROGRAM_BUILD=2018093003
|
PROGRAM_BUILD=2018093005
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
|
|
||||||
@ -4056,7 +4056,7 @@ function FilesBackup {
|
|||||||
encryptDir="$FILE_STORAGE"
|
encryptDir="$FILE_STORAGE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Beginning file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
Logger "Beginning non recursive file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
||||||
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
||||||
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" false true
|
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" false true
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -4091,7 +4091,7 @@ function FilesBackup {
|
|||||||
encryptDir="$FILE_STORAGE"
|
encryptDir="$FILE_STORAGE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Beginning file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
Logger "Beginning recursive child file backup of [$backupTask] to [$destinationDir] as $BACKUP_TYPE backup." "NOTICE"
|
||||||
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
if [ "$ENCRYPTION" == "yes" ] && ([ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]); then
|
||||||
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" true true
|
EncryptFiles "$backupTask" "$CRYPT_STORAGE" "$GPG_RECIPIENT" true true
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -4166,7 +4166,9 @@ function _RotateBackupsLocal {
|
|||||||
copy=$((copy-1))
|
copy=$((copy-1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# TODO: Describe new behavior: Always copy instead of move in order to make delta copies
|
||||||
# Latest file backup will not be moved if script configured for remote backup so next rsync execution will only do delta copy instead of full one
|
# Latest file backup will not be moved if script configured for remote backup so next rsync execution will only do delta copy instead of full one
|
||||||
|
# Whereas sql files will always be moved because we don't do deltas on sql files
|
||||||
if [[ $backup == *.sql.* ]]; then
|
if [[ $backup == *.sql.* ]]; then
|
||||||
cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
||||||
Logger "Launching command [$cmd]." "DEBUG"
|
Logger "Launching command [$cmd]." "DEBUG"
|
||||||
@ -4177,7 +4179,8 @@ function _RotateBackupsLocal {
|
|||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$REMOTE_OPERATION" == "yes" ]; then
|
else
|
||||||
|
#elif [ "$REMOTE_OPERATION" == "yes" ]; then
|
||||||
cmd="cp -R \"$backup\" \"$backup.$PROGRAM.1\""
|
cmd="cp -R \"$backup\" \"$backup.$PROGRAM.1\""
|
||||||
Logger "Launching command [$cmd]." "DEBUG"
|
Logger "Launching command [$cmd]." "DEBUG"
|
||||||
eval "$cmd" &
|
eval "$cmd" &
|
||||||
@ -4187,15 +4190,15 @@ function _RotateBackupsLocal {
|
|||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
#else
|
||||||
cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
# cmd="mv \"$backup\" \"$backup.$PROGRAM.1\""
|
||||||
Logger "Launching command [$cmd]." "DEBUG"
|
# Logger "Launching command [$cmd]." "DEBUG"
|
||||||
eval "$cmd" &
|
# eval "$cmd" &
|
||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING
|
# ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
if [ $? -ne 0 ]; then
|
# if [ $? -ne 0 ]; then
|
||||||
Logger "Cannot move [$backup] to [$backup.$PROGRAM.1]." "ERROR"
|
# Logger "Cannot move [$backup] to [$backup.$PROGRAM.1]." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
# _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
fi
|
# fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user