mirror of
https://github.com/deajan/obackup.git
synced 2026-02-12 18:10:56 +01:00
Minor adapts from osync
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
###### Remote push/pull (or local) backup script for files & databases
|
||||
###### (L) 2013-2015 by Orsiris "Ozy" de Jong (www.netpower.fr)
|
||||
PROGRAM="obackup"
|
||||
AUTHOR="(L) 2013-2015 by Orsiris de Jong"
|
||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||
PROGRAM_VERSION=2.0-pre
|
||||
PROGRAM_BUILD=2015112802
|
||||
PROGRAM_BUILD=2016021601
|
||||
IS_STABLE=no
|
||||
|
||||
source "./ofunctions.sh"
|
||||
@@ -774,17 +773,17 @@ function Rsync {
|
||||
# Creating subdirectories because rsync cannot handle multiple subdirectory creation
|
||||
if [ "$BACKUP_TYPE" == "local" ]; then
|
||||
_CreateDirectoryLocal "$file_storage_path"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||
elif [ "$BACKUP_TYPE" == "pull" ]; then
|
||||
_CreateDirectoryLocal "$file_storage_path"
|
||||
CheckConnectivity3rdPartyHosts
|
||||
CheckConnectivityRemoteHost
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||
CheckConnectivity3rdPartyHosts
|
||||
CheckConnectivityRemoteHost
|
||||
_CreateDirectoryRemote "$file_storage_path"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||
fi
|
||||
|
||||
Logger "cmd: $rsync_cmd" "DEBUG"
|
||||
@@ -1208,21 +1207,10 @@ function Init {
|
||||
RSYNC_ARGS=$RSYNC_ARGS"i"
|
||||
fi
|
||||
|
||||
if [ "$PARTIAL" == "yes" ]; then
|
||||
RSYNC_ARGS=$RSYNC_ARGS" --partial --partial-dir=\"$PARTIAL_DIR\""
|
||||
RSYNC_PARTIAL_EXCLUDE="--exclude=\"$PARTIAL_DIR\""
|
||||
fi
|
||||
|
||||
if [ "$DELETE_VANISHED_FILES" == "yes" ]; then
|
||||
RSYNC_ARGS=$RSYNC_ARGS" --delete"
|
||||
fi
|
||||
|
||||
if [ "$DELTA_COPIES" != "no" ]; then
|
||||
RSYNC_ARGS=$RSYNC_ARGS" --no-whole-file"
|
||||
else
|
||||
RSYNC_ARGS=$RSYNC_ARGS" --whole-file"
|
||||
fi
|
||||
|
||||
if [ $stats -eq 1 ]; then
|
||||
RSYNC_ARGS=$RSYNC_ARGS" --stats"
|
||||
fi
|
||||
@@ -1284,9 +1272,9 @@ function Usage {
|
||||
echo "usage: obackup.sh /path/to/backup.conf [OPTIONS]"
|
||||
echo ""
|
||||
echo "OPTIONS:"
|
||||
echo "--dry: will run obackup without actually doing anything, just testing"
|
||||
echo "--silent: will run obackup without any output to stdout, usefull for cron backups"
|
||||
echo "--verbose: adds command outputs"
|
||||
echo "--dry will run obackup without actually doing anything, just testing"
|
||||
echo "--silent will run obackup without any output to stdout, usefull for cron backups"
|
||||
echo "--verbose adds command outputs"
|
||||
echo "--stats Adds rsync transfer statistics to verbose output"
|
||||
echo "--partial Allows rsync to keep partial downloads that can be resumed later (experimental)"
|
||||
echo "--no-maxtime disables any soft and hard execution time checks"
|
||||
|
||||
Reference in New Issue
Block a user