Skip to content

Commit

Permalink
fix: up 20, down 5
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert committed Oct 11, 2024
1 parent 3c4f19f commit ee12b9c
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions scripts/restart-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ee12b9c

Please sign in to comment.