From ee12b9ca4600f125139a5a874e8d07cb6d6b9d82 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Thu, 10 Oct 2024 22:32:32 -0400 Subject: [PATCH] fix: up 20, down 5 Signed-off-by: Todd Baert --- scripts/restart-wrapper.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/restart-wrapper.sh b/scripts/restart-wrapper.sh index 9ac08d2..2b58036 100644 --- a/scripts/restart-wrapper.sh +++ b/scripts/restart-wrapper.sh @@ -17,17 +17,18 @@ handle_int() { trap handle_term SIGTERM trap handle_int SIGINT -# start change script and our server -echo 'starting process...' -"$@" & -child=$! -sleep 10 -echo "killing pid $child..." -kill -9 "$child" -while kill -0 "$child" 2> /dev/null; do # wait for child to exit (kill -0 is falsy if pid is gone) - sleep 1 -done -echo 'killed...' -sleep 5 -echo 'restarting process...' -"$@" +while [ "$killed" -eq 0 ]; # stop looping if we were interrupted +do + # start change script and our server + echo 'starting process...' + "$@" & + child=$! + sleep 20 + echo "killing pid $child..." + kill -9 "$child" + while kill -0 "$child" 2> /dev/null; do # wait for child to exit (kill -0 is falsy if pid is gone) + sleep 1 + done + echo 'killed...' + sleep 5 +done \ No newline at end of file