1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-12 19:03:42 +01:00

Backup files and directories reffered by symlinks

This commit is contained in:
deajan 2014-11-27 15:35:56 +01:00
parent e828519c32
commit dc784a2671
3 changed files with 30 additions and 6 deletions

View File

@ -3,7 +3,6 @@ SHORT FUTURE IMPROVEMENTS
- Rewrite rsync exclude patterns using \"pattern\" instead of escaped chars
- Clean most of recursive task creation code
- Add symlink support (-L) and edit find -xtype d instead of -type d (xtype won't work with FreeBSD)
KNOWN ISSUES
------------
@ -16,12 +15,14 @@ UNDER WORK
----------
- Commands like cp should have their stderr redirected to log file
- Mysqldump must be checked for not telling success if a table is damaged
- Mysqldump must be checked for not telling success if a table is damaged (also check for event table error)
CHANGELOG
---------
- WARNING: Default behavior is now to copy the referrent files and directories from symlinks (this can reach files outside the backup root)
- Recursive directory search now includes symlinks (find -L option. -type d cannot be replaced by -xtype d because of portability issues with BSD)
- Dry mode does not create target directories anymore
- Dry mode also tries mysqldumps now (check for error messages being logged)
- Added experimental partial download support

View File

@ -2,7 +2,7 @@
###### Remote (or local) backup script for files & databases
###### (L) 2013 by Ozy de Jong (www.netpower.fr)
###### Config file rev 2411201401
###### Config file rev 2711201401
## ---------- GENERAL BACKUP OPTIONS
@ -121,6 +121,14 @@ PRESERVE_ACL=no
## Preserve Xattr. MAke sure source and target FS can hold same Xattr or you'll get loads of errors.
PRESERVE_XATTR=no
## Transforms symlinks into referent files/dirs
COPY_SYMLINKS=yes
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
KEEP_DIRLINKS=yes
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
PRESERVE_HARDLINKS=no
## Let RSYNC compress file transfers. Do not use this on local-local backup schemes. Also, this is not usefull if SSH compression is enabled.
RSYNC_COMPRESS=no
@ -128,6 +136,9 @@ RSYNC_COMPRESS=no
SOFT_MAX_EXEC_TIME_FILE_TASK=3600
HARD_MAX_EXEC_TIME_FILE_TASK=7200
## Keep partial uploads that can be resumed on next run, experimantal feature
PARTIAL=no
## ---------- ALERT OPTIONS
## Alert email adresses separated by a space character

View File

@ -5,7 +5,7 @@
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.84preRC4
PROGRAM_BUILD=2711201402
PROGRAM_BUILD=2711201404
## 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
@ -860,10 +860,10 @@ function ListDirectories
LogError "Connectivity test failed. Stopping current task."
Dummy &
else
eval "$SSH_CMD \"$COMMAND_SUDO $FIND_CMD $dir/ -mindepth 1 -maxdepth 1 -type d\" > $RUN_DIR/obackup_dirs_recurse_list_$SCRIPT_PID &"
eval "$SSH_CMD \"$COMMAND_SUDO $FIND_CMD -L $dir/ -mindepth 1 -maxdepth 1 -type d\" > $RUN_DIR/obackup_dirs_recurse_list_$SCRIPT_PID &"
fi
else
eval "$COMMAND_SUDO $FIND_CMD $dir/ -mindepth 1 -maxdepth 1 -type d > $RUN_DIR/obackup_dirs_recurse_list_$SCRIPT_PID &"
eval "$COMMAND_SUDO $FIND_CMD -L $dir/ -mindepth 1 -maxdepth 1 -type d > $RUN_DIR/obackup_dirs_recurse_list_$SCRIPT_PID &"
fi
child_pid=$!
WaitForTaskCompletion $child_pid $SOFT_MAX_EXEC_TIME_FILE_TASK $HARD_MAX_EXEC_TIME_FILE_TASK
@ -1261,6 +1261,18 @@ function Init
then
RSYNC_ARGS=$RSYNC_ARGS"z"
fi
if [ "$COPY_SYMLINKS" != "no" ]
then
RSYNC_ARGS=$RSYNC_ARGS" -L"
fi
if [ "$KEEP_DIRLINKS" != "no" ]
then
RSYNC_ARGS=$RSYNC_ARGS" -K"
fi
if [ "$PRESERVE_HARDLINKS" == "yes" ]
then
RSYNC_ARGS=$RSYNC_ARGS" -H"
fi
if [ $verbose -eq 1 ]
then
RSYNC_ARGS=$RSYNC_ARGS"i"