1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-14 03:33:41 +01:00

Improved some output

This commit is contained in:
deajan 2014-11-28 14:56:53 +01:00
parent 4662627a4a
commit ec7140e963
2 changed files with 13 additions and 12 deletions

View File

@ -21,6 +21,8 @@ UNDER WORK
CHANGELOG CHANGELOG
--------- ---------
- Prevented triggering TrapError if there are no child processes to terminate on TrapQuit
- Improved mysql debug logs
- Prevent creation of backup-id less log file when DEBUG is set - Prevent creation of backup-id less log file when DEBUG is set
- WARNING: Default behavior is now to copy the referrent files and directories from symlinks (this can reach files outside the backup root) - 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) - Recursive directory search now includes symlinks (find -L option. -type d cannot be replaced by -xtype d because of portability issues with BSD)

View File

@ -5,7 +5,7 @@
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.84RC4 PROGRAM_VERSION=1.84RC4
PROGRAM_BUILD=2811201401 PROGRAM_BUILD=2811201403
## 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
@ -126,7 +126,8 @@ function TrapQuit
# Kill all child processes # Kill all child processes
if type -p pkill > /dev/null 2>&1 if type -p pkill > /dev/null 2>&1
then then
pkill -TERM -P $$ ## Added || : to return success even if there is no child process to kill
pkill -TERM -P $$ || :
elif [ "$LOCAL_OS" == "msys" ] || [ "$OSTYPE" == "msys" ] elif [ "$LOCAL_OS" == "msys" ] || [ "$OSTYPE" == "msys" ]
then then
## This is not really a clean way to get child process pids, especially the tail -n +2 which resolves a strange char apparition in msys bash ## This is not really a clean way to get child process pids, especially the tail -n +2 which resolves a strange char apparition in msys bash
@ -707,10 +708,13 @@ function ListDatabases
CheckConnectivityRemoteHost CheckConnectivityRemoteHost
if [ "$REMOTE_BACKUP" != "no" ] if [ "$REMOTE_BACKUP" != "no" ]
then then
eval "$SSH_CMD \"mysql -u $SQL_USER -Bse 'SELECT table_schema, round(sum( data_length + index_length ) / 1024) FROM information_schema.TABLES GROUP by table_schema;'\" > $RUN_DIR/obackup_dblist_$SCRIPT_PID &" sql_cmd="$SSH_CMD \"mysql -u $SQL_USER -Bse 'SELECT table_schema, round(sum( data_length + index_length ) / 1024) FROM information_schema.TABLES GROUP by table_schema;'\" > $RUN_DIR/obackup_dblist_$SCRIPT_PID &"
else else
mysql -u $SQL_USER -Bse 'SELECT table_schema, round(sum( data_length + index_length ) / 1024) FROM information_schema.TABLES GROUP by table_schema;' > $RUN_DIR/obackup_dblist_$SCRIPT_PID & sql_cmd="mysql -u $SQL_USER -Bse 'SELECT table_schema, round(sum( data_length + index_length ) / 1024) FROM information_schema.TABLES GROUP by table_schema;' > $RUN_DIR/obackup_dblist_$SCRIPT_PID &"
fi fi
LogDebug "$sql_cmd"
eval "$sql_cmd 2>&1"
child_pid=$! child_pid=$!
WaitForTaskCompletion $child_pid $SOFT_MAX_EXEC_TIME_DB_TASK $HARD_MAX_EXEC_TIME_DB_TASK WaitForTaskCompletion $child_pid $SOFT_MAX_EXEC_TIME_DB_TASK $HARD_MAX_EXEC_TIME_DB_TASK
retval=$? retval=$?
@ -804,10 +808,7 @@ function BackupDatabase
sql_cmd="mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS > $LOCAL_SQL_STORAGE/$1.sql$COMPRESSION_EXTENSION" sql_cmd="mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS > $LOCAL_SQL_STORAGE/$1.sql$COMPRESSION_EXTENSION"
fi fi
if [ $verbose -eq 1 ] LogDebug "SQL_CMD: $sql_cmd"
then
Log "SQL_CMD: $sql_cmd"
fi
if [ $dryrun -ne 1 ] if [ $dryrun -ne 1 ]
then then
@ -1036,10 +1037,8 @@ function Rsync
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$1\" \"$local_file_storage_path\" > $RUN_DIR/obackup_rsync_output_$SCRIPT_PID 2>&1" rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$1\" \"$local_file_storage_path\" > $RUN_DIR/obackup_rsync_output_$SCRIPT_PID 2>&1"
fi fi
#### Eval is used so the full command is processed without bash adding single quotes round variables #### Eval is used so the full command is processed without bash adding single quotes round variables
if [ $verbose -eq 1 ] LogDebug "RSYNC_CMD: $rsync_cmd"
then
Log "RSYNC_CMD: $rsync_cmd"
fi
eval $rsync_cmd eval $rsync_cmd
exit $? exit $?
} }