mirror of
https://github.com/deajan/obackup.git
synced 2025-01-12 15:13:53 +01:00
More debugging in KillChilds
This commit is contained in:
parent
f5dfc478a2
commit
1913c897f1
@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre
|
|||||||
PROGRAM_BUILD=2016040603
|
PROGRAM_BUILD=2016040603
|
||||||
IS_STABLE=no
|
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
|
## 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
|
||||||
@ -164,16 +164,22 @@ function KillChilds {
|
|||||||
|
|
||||||
# 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 ]; then
|
||||||
Logger "Killing process $pid" "DEBUG"
|
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
||||||
kill -s SIGTERM "$pid"
|
kill -s SIGTERM "$pid"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
sleep 15 && kill -9 "$pid" &
|
sleep 15
|
||||||
return 1
|
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
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# sleep 15 needs to wait before killing itself
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SendAlert {
|
function SendAlert {
|
||||||
|
@ -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
|
## 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
|
||||||
@ -154,16 +154,22 @@ function KillChilds {
|
|||||||
|
|
||||||
# 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 ]; then
|
||||||
Logger "Killing process $pid" "DEBUG"
|
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
||||||
kill -s SIGTERM "$pid"
|
kill -s SIGTERM "$pid"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
sleep 15 && kill -9 "$pid" &
|
sleep 15
|
||||||
return 1
|
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
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# sleep 15 needs to wait before killing itself
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SendAlert {
|
function SendAlert {
|
||||||
|
16
obackup.sh
16
obackup.sh
@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre
|
|||||||
PROGRAM_BUILD=2016040603
|
PROGRAM_BUILD=2016040603
|
||||||
IS_STABLE=no
|
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
|
## 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
|
||||||
@ -154,16 +154,22 @@ function KillChilds {
|
|||||||
|
|
||||||
# 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 ]; then
|
||||||
Logger "Killing process $pid" "DEBUG"
|
Logger "Sending SIGTERM to process [$pid]." "DEBUG"
|
||||||
kill -s SIGTERM "$pid"
|
kill -s SIGTERM "$pid"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
sleep 15 && kill -9 "$pid" &
|
sleep 15
|
||||||
return 1
|
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
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# sleep 15 needs to wait before killing itself
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SendAlert {
|
function SendAlert {
|
||||||
|
Loading…
Reference in New Issue
Block a user