Skip to content

Commit ee12b9c

Browse files
committedOct 11, 2024·
fix: up 20, down 5
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1 parent 3c4f19f commit ee12b9c

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed
 

‎scripts/restart-wrapper.sh

+15-14
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ handle_int() {
1717
trap handle_term SIGTERM
1818
trap handle_int SIGINT
1919

20-
# start change script and our server
21-
echo 'starting process...'
22-
"$@" &
23-
child=$!
24-
sleep 10
25-
echo "killing pid $child..."
26-
kill -9 "$child"
27-
while kill -0 "$child" 2> /dev/null; do # wait for child to exit (kill -0 is falsy if pid is gone)
28-
sleep 1
29-
done
30-
echo 'killed...'
31-
sleep 5
32-
echo 'restarting process...'
33-
"$@"
20+
while [ "$killed" -eq 0 ]; # stop looping if we were interrupted
21+
do
22+
# start change script and our server
23+
echo 'starting process...'
24+
"$@" &
25+
child=$!
26+
sleep 20
27+
echo "killing pid $child..."
28+
kill -9 "$child"
29+
while kill -0 "$child" 2> /dev/null; do # wait for child to exit (kill -0 is falsy if pid is gone)
30+
sleep 1
31+
done
32+
echo 'killed...'
33+
sleep 5
34+
done

0 commit comments

Comments
 (0)
Please sign in to comment.