mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-04-16 23:08:38 +02:00
idle cpu fix test (#6015)
This commit is contained in:
@@ -287,10 +287,20 @@ start_unoserver_watchdog() {
|
||||
|
||||
if [ "$needs_restart" = true ]; then
|
||||
log "Restarting unoserver on 127.0.0.1:${port} (uno-port ${uno_port})"
|
||||
# Kill the old process if it exists
|
||||
# Kill the old process and its children (soffice) if it exists.
|
||||
# Capture child PIDs first, then send TERM to children before parent
|
||||
# so the PPID relationship is still visible. After sleep, use the
|
||||
# saved PIDs for SIGKILL since the parent may have already exited
|
||||
# and children would be reparented to init.
|
||||
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
||||
local child_pids
|
||||
child_pids=$(pgrep -P "$pid" 2>/dev/null || true)
|
||||
pkill -TERM -P "$pid" 2>/dev/null || true
|
||||
kill -TERM "$pid" 2>/dev/null || true
|
||||
sleep 1
|
||||
sleep 3
|
||||
if [ -n "$child_pids" ]; then
|
||||
kill -KILL $child_pids 2>/dev/null || true
|
||||
fi
|
||||
kill -KILL "$pid" 2>/dev/null || true
|
||||
fi
|
||||
start_unoserver_instance "$port" "$uno_port"
|
||||
|
||||
Reference in New Issue
Block a user