mirror of
https://github.com/deajan/obackup.git
synced 2025-01-12 15:13:53 +01:00
More debugging love for KillChilds
This commit is contained in:
parent
1913c897f1
commit
2c51055209
@ -5,10 +5,10 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2016040603
|
PROGRAM_BUILD=2016041201
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
## FUNC_BUILD=2016041201
|
## FUNC_BUILD=2016041202
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -157,13 +157,13 @@ function KillChilds {
|
|||||||
|
|
||||||
if children="$(pgrep -P "$pid")"; then
|
if children="$(pgrep -P "$pid")"; then
|
||||||
for child in $children; do
|
for child in $children; do
|
||||||
Logger "Launching KillChilds \"$child\" true" "DEBUG"
|
Logger "Launching KillChilds \"$child\" true" "DEBUG" #__WITH_PARANOIA_DEBUG
|
||||||
KillChilds "$child" true
|
KillChilds "$child" true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
|
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
|
||||||
if [ "$self" == true ]; then
|
if ( [ "$self" == true ] && eval $PROCESS_TEST_CMD > /dev/null 2>&1); then
|
||||||
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
||||||
kill -s SIGTERM "$pid"
|
kill -s SIGTERM "$pid"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
@ -173,12 +173,11 @@ function KillChilds {
|
|||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2391,6 +2390,11 @@ if [ "$IS_STABLE" != "yes" ]; then
|
|||||||
Logger "This is an unstable dev build. Please use with caution." "WARN"
|
Logger "This is an unstable dev build. Please use with caution." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DATE=$(date)
|
||||||
|
Logger "--------------------------------------------------------------------" "NOTICE"
|
||||||
|
Logger "$DRY_WARNING $DATE - $PROGRAM v$PROGRAM_VERSION $BACKUP_TYPE script begin." "NOTICE"
|
||||||
|
Logger "--------------------------------------------------------------------" "NOTICE"
|
||||||
|
Logger "Backup instance [$INSTANCE_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" "NOTICE"
|
||||||
|
|
||||||
GetLocalOS
|
GetLocalOS
|
||||||
InitLocalOSSettings
|
InitLocalOSSettings
|
||||||
@ -2401,12 +2405,6 @@ Init
|
|||||||
PostInit
|
PostInit
|
||||||
CheckCurrentConfig
|
CheckCurrentConfig
|
||||||
|
|
||||||
DATE=$(date)
|
|
||||||
Logger "--------------------------------------------------------------------" "NOTICE"
|
|
||||||
Logger "$DRY_WARNING $DATE - $PROGRAM v$PROGRAM_VERSION $BACKUP_TYPE script begin." "NOTICE"
|
|
||||||
Logger "--------------------------------------------------------------------" "NOTICE"
|
|
||||||
Logger "Backup instance [$INSTANCE_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" "NOTICE"
|
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
||||||
GetRemoteOS
|
GetRemoteOS
|
||||||
InitRemoteOSSettings
|
InitRemoteOSSettings
|
||||||
|
@ -5,7 +5,7 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2016040603
|
PROGRAM_BUILD=2016041201
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
source "./ofunctions.sh"
|
source "./ofunctions.sh"
|
||||||
@ -1359,6 +1359,11 @@ if [ "$IS_STABLE" != "yes" ]; then
|
|||||||
Logger "This is an unstable dev build. Please use with caution." "WARN"
|
Logger "This is an unstable dev build. Please use with caution." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DATE=$(date)
|
||||||
|
Logger "--------------------------------------------------------------------" "NOTICE"
|
||||||
|
Logger "$DRY_WARNING $DATE - $PROGRAM v$PROGRAM_VERSION $BACKUP_TYPE script begin." "NOTICE"
|
||||||
|
Logger "--------------------------------------------------------------------" "NOTICE"
|
||||||
|
Logger "Backup instance [$INSTANCE_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" "NOTICE"
|
||||||
|
|
||||||
GetLocalOS
|
GetLocalOS
|
||||||
InitLocalOSSettings
|
InitLocalOSSettings
|
||||||
@ -1369,12 +1374,6 @@ Init
|
|||||||
PostInit
|
PostInit
|
||||||
CheckCurrentConfig
|
CheckCurrentConfig
|
||||||
|
|
||||||
DATE=$(date)
|
|
||||||
Logger "--------------------------------------------------------------------" "NOTICE"
|
|
||||||
Logger "$DRY_WARNING $DATE - $PROGRAM v$PROGRAM_VERSION $BACKUP_TYPE script begin." "NOTICE"
|
|
||||||
Logger "--------------------------------------------------------------------" "NOTICE"
|
|
||||||
Logger "Backup instance [$INSTANCE_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" "NOTICE"
|
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
||||||
GetRemoteOS
|
GetRemoteOS
|
||||||
InitRemoteOSSettings
|
InitRemoteOSSettings
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
## FUNC_BUILD=2016041201
|
## FUNC_BUILD=2016041202
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -147,13 +147,13 @@ function KillChilds {
|
|||||||
|
|
||||||
if children="$(pgrep -P "$pid")"; then
|
if children="$(pgrep -P "$pid")"; then
|
||||||
for child in $children; do
|
for child in $children; do
|
||||||
Logger "Launching KillChilds \"$child\" true" "DEBUG"
|
Logger "Launching KillChilds \"$child\" true" "DEBUG" #__WITH_PARANOIA_DEBUG
|
||||||
KillChilds "$child" true
|
KillChilds "$child" true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
|
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
|
||||||
if [ "$self" == true ]; then
|
if ( [ "$self" == true ] && eval $PROCESS_TEST_CMD > /dev/null 2>&1); then
|
||||||
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
||||||
kill -s SIGTERM "$pid"
|
kill -s SIGTERM "$pid"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
@ -163,12 +163,11 @@ function KillChilds {
|
|||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
obackup.sh
25
obackup.sh
@ -5,10 +5,10 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2016040603
|
PROGRAM_BUILD=2016041201
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
## FUNC_BUILD=2016041201
|
## FUNC_BUILD=2016041202
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -147,13 +147,12 @@ function KillChilds {
|
|||||||
|
|
||||||
if children="$(pgrep -P "$pid")"; then
|
if children="$(pgrep -P "$pid")"; then
|
||||||
for child in $children; do
|
for child in $children; do
|
||||||
Logger "Launching KillChilds \"$child\" true" "DEBUG"
|
|
||||||
KillChilds "$child" true
|
KillChilds "$child" true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
|
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
|
||||||
if [ "$self" == true ]; then
|
if ( [ "$self" == true ] && eval $PROCESS_TEST_CMD > /dev/null 2>&1); then
|
||||||
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
||||||
kill -s SIGTERM "$pid"
|
kill -s SIGTERM "$pid"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
@ -163,12 +162,11 @@ function KillChilds {
|
|||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2281,6 +2279,11 @@ if [ "$IS_STABLE" != "yes" ]; then
|
|||||||
Logger "This is an unstable dev build. Please use with caution." "WARN"
|
Logger "This is an unstable dev build. Please use with caution." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DATE=$(date)
|
||||||
|
Logger "--------------------------------------------------------------------" "NOTICE"
|
||||||
|
Logger "$DRY_WARNING $DATE - $PROGRAM v$PROGRAM_VERSION $BACKUP_TYPE script begin." "NOTICE"
|
||||||
|
Logger "--------------------------------------------------------------------" "NOTICE"
|
||||||
|
Logger "Backup instance [$INSTANCE_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" "NOTICE"
|
||||||
|
|
||||||
GetLocalOS
|
GetLocalOS
|
||||||
InitLocalOSSettings
|
InitLocalOSSettings
|
||||||
@ -2291,12 +2294,6 @@ Init
|
|||||||
PostInit
|
PostInit
|
||||||
CheckCurrentConfig
|
CheckCurrentConfig
|
||||||
|
|
||||||
DATE=$(date)
|
|
||||||
Logger "--------------------------------------------------------------------" "NOTICE"
|
|
||||||
Logger "$DRY_WARNING $DATE - $PROGRAM v$PROGRAM_VERSION $BACKUP_TYPE script begin." "NOTICE"
|
|
||||||
Logger "--------------------------------------------------------------------" "NOTICE"
|
|
||||||
Logger "Backup instance [$INSTANCE_ID] launched as $LOCAL_USER@$LOCAL_HOST (PID $SCRIPT_PID)" "NOTICE"
|
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
||||||
GetRemoteOS
|
GetRemoteOS
|
||||||
InitRemoteOSSettings
|
InitRemoteOSSettings
|
||||||
|
Loading…
Reference in New Issue
Block a user