From 7b43c2955e2c550caf7154f8325d297a956673b4 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Thu, 3 Dec 2020 15:35:50 -0500 Subject: [PATCH] [fix] kill old restart pid and assign new pid for start --- setup/so-functions | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index d6c309431..67cbb7c24 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1650,13 +1650,19 @@ salt_checkin() { count=0 while ! (check_service_status "$service"); do + # On final loop, kill the pid trying to restart service and try to manually kill then start it if [ $count -eq 12 ]; then - systemctl kill "$service" - systemctl start "$service" + { + kill -9 "$pid" + systemctl kill "$service" + systemctl start "$service" & + local pid=$! + } >> "$setup_log" 2>&1 fi if [ $count -gt 12 ]; then echo "$service could not be restarted in 120 seconds, exiting" >> "$setup_log" 2>&1 + kill -9 "$pid" kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1 fi sleep 10;