mirror of
https://github.com/deajan/obackup.git
synced 2025-02-06 03:13:49 +01:00
Improved force quitting
This commit is contained in:
parent
eb0bb0a3f8
commit
6524cf9a69
@ -7,9 +7,12 @@
|
|||||||
## Known issues
|
## Known issues
|
||||||
|
|
||||||
- Backup size check counts excluded patterns
|
- Backup size check counts excluded patterns
|
||||||
|
- Recursive task creation from directories does only include subdirectories, but no files in root directory
|
||||||
|
|
||||||
## Latest changelog
|
## Latest changelog
|
||||||
|
|
||||||
|
- Improved forced quit command by killing all child processes
|
||||||
|
- Before / After commands are now ignored on dryruns
|
||||||
- Improved verbose output
|
- Improved verbose output
|
||||||
- Improved dryrun output
|
- Improved dryrun output
|
||||||
- Improved remote connecivity detection
|
- Improved remote connecivity detection
|
||||||
|
31
obackup.sh
31
obackup.sh
@ -41,7 +41,7 @@ function Log
|
|||||||
echo "TIME: $SECONDS - $1" >> "$LOG_FILE"
|
echo "TIME: $SECONDS - $1" >> "$LOG_FILE"
|
||||||
if [ $silent -eq 0 ]
|
if [ $silent -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "TIME: $SECONDS - $1"
|
echo -e "TIME: $SECONDS - $1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +70,9 @@ function TrapStop
|
|||||||
|
|
||||||
function TrapQuit
|
function TrapQuit
|
||||||
{
|
{
|
||||||
|
# Kill all child processes
|
||||||
|
pkill -TERM -P $$
|
||||||
|
|
||||||
if [ $error_alert -ne 0 ]
|
if [ $error_alert -ne 0 ]
|
||||||
then
|
then
|
||||||
SendAlert
|
SendAlert
|
||||||
@ -285,6 +288,11 @@ function WaitForTaskCompletion
|
|||||||
## Runs local command $1 and waits for completition in $2 seconds
|
## Runs local command $1 and waits for completition in $2 seconds
|
||||||
function RunLocalCommand
|
function RunLocalCommand
|
||||||
{
|
{
|
||||||
|
if [ $dryrun -ne 0 ]
|
||||||
|
then
|
||||||
|
Log "Dryrun: Local command [$1] not run."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
$1 > /dev/shm/obackup_run_local_$SCRIPT_PID 2>&1 &
|
$1 > /dev/shm/obackup_run_local_$SCRIPT_PID 2>&1 &
|
||||||
child_pid=$!
|
child_pid=$!
|
||||||
WaitForTaskCompletion $child_pid 0 $2
|
WaitForTaskCompletion $child_pid 0 $2
|
||||||
@ -307,13 +315,12 @@ function RunRemoteCommand
|
|||||||
{
|
{
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
if [ $? != 0 ]
|
if [ $dryrun -ne 0 ]
|
||||||
then
|
then
|
||||||
LogError "Connectivity test failed. Cannot run remote command."
|
Log "Dryrun: Remote command [$1] not run."
|
||||||
return 1
|
return 1
|
||||||
else
|
fi
|
||||||
eval "$SSH_CMD \"$1\" > /dev/shm/obackup_run_remote_$SCRIPT_PID 2>&1 &"
|
eval "$SSH_CMD \"$1\" > /dev/shm/obackup_run_remote_$SCRIPT_PID 2>&1 &"
|
||||||
fi
|
|
||||||
child_pid=$!
|
child_pid=$!
|
||||||
WaitForTaskCompletion $child_pid 0 $2
|
WaitForTaskCompletion $child_pid 0 $2
|
||||||
retval=$?
|
retval=$?
|
||||||
@ -517,7 +524,7 @@ function ListDatabases
|
|||||||
LogError "Listing databases failed."
|
LogError "Listing databases failed."
|
||||||
if [ -f /dev/shm/obackup_dblist_$SCRIPT_PID ]
|
if [ -f /dev/shm/obackup_dblist_$SCRIPT_PID ]
|
||||||
then
|
then
|
||||||
LogError "Command output: $(cat /dev/shm/obackup_dblist_$SCRIPT_PID)"
|
LogError "Command output:\n$(cat /dev/shm/obackup_dblist_$SCRIPT_PID)"
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
@ -643,7 +650,7 @@ function ListDirectories
|
|||||||
LogError "Could not enumerate recursive directories in $dir."
|
LogError "Could not enumerate recursive directories in $dir."
|
||||||
if [ -f /dev/shm/obackup_dirs_recurse_list_$SCRIPT_PID ]
|
if [ -f /dev/shm/obackup_dirs_recurse_list_$SCRIPT_PID ]
|
||||||
then
|
then
|
||||||
LogError "Command output: $(cat /dev/shm/obackup_dirs_recurse_list_$SCRIPT_PID)"
|
LogError "Command output:\n$(cat /dev/shm/obackup_dirs_recurse_list_$SCRIPT_PID)"
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@ -716,7 +723,7 @@ function GetDirectoriesSize
|
|||||||
LogError "Could not get files size."
|
LogError "Could not get files size."
|
||||||
if [ -f /dev/shm/obackup_fsize_$SCRIPT_PID ]
|
if [ -f /dev/shm/obackup_fsize_$SCRIPT_PID ]
|
||||||
then
|
then
|
||||||
LogError "Command output: $(cat /dev/shm/obackup_fsize_$SCRIPT_PID)"
|
LogError "Command output:\n$(cat /dev/shm/obackup_fsize_$SCRIPT_PID)"
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@ -1026,7 +1033,7 @@ function Usage
|
|||||||
{
|
{
|
||||||
echo "Obackup $OBACKUP_VERSION $OBACKUP_BUILD"
|
echo "Obackup $OBACKUP_VERSION $OBACKUP_BUILD"
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: obackup backup_name [--dry] [--silent] [--verbose] [--no-maxtime]"
|
echo "usage: obackup /path/to/backup.conf [--dry] [--silent] [--verbose] [--no-maxtime]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "--dry: will run obackup without actually doing anything, just testing"
|
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 "--silent: will run obackup without any output to stdout, usefull for cron backups"
|
||||||
|
Loading…
Reference in New Issue
Block a user