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

More debugging in KillChilds

This commit is contained in:
deajan 2016-04-12 09:14:44 +02:00
parent f5dfc478a2
commit 1913c897f1
3 changed files with 33 additions and 15 deletions

View File

@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre
PROGRAM_BUILD=2016040603
IS_STABLE=no
## FUNC_BUILD=2016041001
## FUNC_BUILD=2016041201
## 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
@ -164,16 +164,22 @@ function KillChilds {
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
if [ "$self" == true ]; then
Logger "Killing process $pid" "DEBUG"
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
kill -s SIGTERM "$pid"
if [ $? != 0 ]; then
sleep 15 && kill -9 "$pid" &
return 1
sleep 15
Logger "Sending SIGTERM to process [$pid] failed." "DEBUG"
kill -9 "$pid"
if [ $? != 0 ]; then
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
return 1
else
return 0
fi
else
return 0
fi
fi
# sleep 15 needs to wait before killing itself
}
function SendAlert {

View File

@ -1,4 +1,4 @@
## FUNC_BUILD=2016041001
## FUNC_BUILD=2016041201
## 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
@ -154,16 +154,22 @@ function KillChilds {
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
if [ "$self" == true ]; then
Logger "Killing process $pid" "DEBUG"
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
kill -s SIGTERM "$pid"
if [ $? != 0 ]; then
sleep 15 && kill -9 "$pid" &
return 1
sleep 15
Logger "Sending SIGTERM to process [$pid] failed." "DEBUG"
kill -9 "$pid"
if [ $? != 0 ]; then
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
return 1
else
return 0
fi
else
return 0
fi
fi
# sleep 15 needs to wait before killing itself
}
function SendAlert {

View File

@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre
PROGRAM_BUILD=2016040603
IS_STABLE=no
## FUNC_BUILD=2016041001
## FUNC_BUILD=2016041201
## 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
@ -154,16 +154,22 @@ function KillChilds {
# Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing
if [ "$self" == true ]; then
Logger "Killing process $pid" "DEBUG"
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
kill -s SIGTERM "$pid"
if [ $? != 0 ]; then
sleep 15 && kill -9 "$pid" &
return 1
sleep 15
Logger "Sending SIGTERM to process [$pid] failed." "DEBUG"
kill -9 "$pid"
if [ $? != 0 ]; then
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
return 1
else
return 0
fi
else
return 0
fi
fi
# sleep 15 needs to wait before killing itself
}
function SendAlert {