mirror of https://github.com/deajan/osync.git
Allow graceful killing of processes
parent
d3c9b9f024
commit
9683af5b2d
|
|
@ -388,16 +388,17 @@ function KillChilds {
|
|||
kill -s TERM "$pid"
|
||||
Logger "Sent SIGTERM to process [$pid]." "DEBUG"
|
||||
if [ $? -ne 0 ]; then
|
||||
sleep 15
|
||||
Logger "Sending SIGTERM to process [$pid] failed." "DEBUG"
|
||||
kill -9 "$pid"
|
||||
if [ $? -ne 0 ]; then
|
||||
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
||||
return 1
|
||||
fi # Simplify the return 0 logic here
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
sleep 60 # Arbitrary wait time to let process terminate gracefully
|
||||
if kill -0 "$pid" > /dev/null 2>&1; then
|
||||
Logger "Sending SIGTERM to process [$pid] failed." "DEBUG"
|
||||
kill -9 "$pid"
|
||||
if [ $? -ne 0 ]; then
|
||||
Logger "Sending SIGKILL to process [$pid] failed." "DEBUG"
|
||||
return 1
|
||||
fi # Simplify the return 0 logic here
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue