mirror of
https://github.com/deajan/obackup.git
synced 2024-12-04 20:53:41 +01:00
Added some rsync parameters
This commit is contained in:
parent
6938422cc2
commit
c81fa58040
@ -1,5 +1,7 @@
|
||||
## Latest changelog
|
||||
|
||||
- Added some Rsync argument parameters (preserve ACL, Xattr, and stream compression)
|
||||
- Internal hook execution logic revised
|
||||
- Updated WaitForTaskCompletition function to handle skipping alerts
|
||||
- Updated command line argument --silent processing
|
||||
- Added remote before and after command execution hook
|
||||
|
1
TODO.md
1
TODO.md
@ -3,7 +3,6 @@
|
||||
Upcomming features:
|
||||
|
||||
- Write proper documentation
|
||||
- Add option to enable ACL backup (with rsync, and tar rotated copies)
|
||||
|
||||
Bugs not yet addressed that will be done a bit later:
|
||||
|
||||
|
@ -57,14 +57,20 @@ COMPRESSION_REMOTE=yes
|
||||
|
||||
## Path separator. You can set whatever seperator you want in your directories list below. You may change this in case you have some esoteric filenames (try to use unconventional separators like | ).
|
||||
PATH_SEPARATOR_CHAR=";"
|
||||
## File backup lists. Simple double quoted directory list separated by the $PATH_SEPARATOR_CHAR. Every directory will be processed as task (see documentation for explanation about tasks)
|
||||
## File backup lists. Double quoted directory list separated by the $PATH_SEPARATOR_CHAR. Every directory will be processed as task (see documentation for explanation about tasks)
|
||||
DIRECTORIES_SIMPLE_LIST="/var/named"
|
||||
## Recurse directory list separated by the $PATH_SEPARATOR_CHAR. Will create a backup task per subdirectory (one level only), eg RECURSE_LIST="/home /var" will create tasks "/home/dir1", "/home/dir2", ... "/home/dirN", "/var/log", "/var/lib"... "/var/whatever"
|
||||
DIRECTORIES_RECURSE_LIST="/home"
|
||||
## You can optionally exclude directories from RECURSE_LIST tasks, eg on the above example you could exclude /home/dir2 by adding it to RECURSE_EXCLUDE_LIST
|
||||
DIRECTORIES_RECURSE_EXCLUDE_LIST="/home/backupuser;/home/lost+found"
|
||||
# Be aware that every recurse list will have it's own root (exclude pattern is relative from /home/web for /home/web/{recursedir})
|
||||
## Be aware that every recurse list will have it's own root (exclude pattern is relative from /home/web for /home/web/{recursedir})
|
||||
RSYNC_EXCLUDE_PATTERN="*/tmp;*/ftp/www/cache/cachefs;*/sessions"
|
||||
## Preserve ACLS. Make sure target FS can hold ACLs or you'll get loads of errors.
|
||||
PRESERVE_ACL=yes
|
||||
## Preserve Xattr
|
||||
PRESERVE_XATTR=yes
|
||||
## Let RSYNC compress file transfers. Do not use if you already enabled SSH compression.
|
||||
RSYNC_COMPRESS=yes
|
||||
## Max execution time per file backup task. Soft is warning only. Hard is warning, stopping backup and processing next one one file list. Tilme is specified in seconds
|
||||
SOFT_MAX_EXEC_TIME_FILE_TASK=3600
|
||||
HARD_MAX_EXEC_TIME_FILE_TASK=7200
|
||||
@ -91,4 +97,3 @@ REMOTE_RUN_AFTER_CMD=""
|
||||
MAX_EXEC_TIME_PER_CMD_BEFORE=0
|
||||
MAX_EXEC_TIME_PER_CMD_AFTER=0
|
||||
|
||||
|
||||
|
26
obackup.sh
26
obackup.sh
@ -2,7 +2,7 @@
|
||||
|
||||
###### Remote (or local) backup script for files & databases
|
||||
###### (L) 2013 by Ozy de Jong (www.badministrateur.com)
|
||||
OBACKUP_VERSION=1.83 #### Build 1606201303
|
||||
OBACKUP_VERSION=1.83 #### Build 1706201301
|
||||
|
||||
DEBUG=no
|
||||
SCRIPT_PID=$$
|
||||
@ -705,6 +705,25 @@ function RsyncExcludePattern
|
||||
IFS=$OLD_IFS
|
||||
}
|
||||
|
||||
function RsyncArgs
|
||||
{
|
||||
RSYNC_ARGS=-rlptgoDE
|
||||
if [ "$PRESERVE_ACLS" == "yes" ]
|
||||
then
|
||||
RSYNC_ARGS=$RSYNC_ARGS"A"
|
||||
fi
|
||||
|
||||
if [ "$PRESERVE_XATTR" == "yes" ]
|
||||
then
|
||||
RSYNC_ARGS=$RSYNC_ARGS"X"
|
||||
fi
|
||||
|
||||
if [ "$RSYNC_COMPRESS" == "yes" ]
|
||||
then
|
||||
RSYNC_ARGS=$RSYNC_ARGS"z"
|
||||
fi
|
||||
}
|
||||
|
||||
function Rsync
|
||||
{
|
||||
i="$(StripQuotes $1)"
|
||||
@ -734,9 +753,9 @@ function Rsync
|
||||
LogError "Connectivity test failed. Stopping current task."
|
||||
exit 1
|
||||
fi
|
||||
rsync_cmd="$(which rsync) -rlptgoDE --delete $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$(which ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT\" \"$REMOTE_USER@$REMOTE_HOST:$1\" \"$local_file_storage_path\" > /dev/shm/obackup_rsync_output_$SCRIPT_PID 2>&1"
|
||||
rsync_cmd="$(which rsync) $RSYNC_ARGS --delete $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$(which ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT\" \"$REMOTE_USER@$REMOTE_HOST:$1\" \"$local_file_storage_path\" > /dev/shm/obackup_rsync_output_$SCRIPT_PID 2>&1"
|
||||
else
|
||||
rsync_cmd="$(which rsync) -rlptgoDE --delete $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$1\" \"$local_file_storage_path\" > /dev/shm/obackup_rsync_output_$SCRIPT_PID 2>&1"
|
||||
rsync_cmd="$(which rsync) $RSYNC_ARGS --delete $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$1\" \"$local_file_storage_path\" > /dev/shm/obackup_rsync_output_$SCRIPT_PID 2>&1"
|
||||
fi
|
||||
#### Eval is used so the full command is processed without bash adding single quotes round variables
|
||||
if [ "$DEBUG" == "yes" ]
|
||||
@ -914,6 +933,7 @@ function Main
|
||||
RotateBackups $LOCAL_FILE_STORAGE
|
||||
fi
|
||||
RsyncExcludePattern
|
||||
RsyncArgs
|
||||
FilesBackup
|
||||
fi
|
||||
# Be a happy sysadmin (and drink a coffee ? Nahh... it's past midnight.)
|
||||
|
Loading…
Reference in New Issue
Block a user