Skip to content

Commit 6249dde

Browse files
committedOct 11, 2024·
fix: restart once
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1 parent b6279e5 commit 6249dde

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed
 

‎scripts/restart-wrapper.sh

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

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 10 && echo "killing pid $child..." && 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 process...' && sleep 5
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
3129
done
30+
echo 'killed...'
31+
sleep 5
32+
echo 'restarting process...'
33+
"$@"

0 commit comments

Comments
 (0)
Please sign in to comment.