Skip to content

Commit

Permalink
Fix order bug in bootstrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
HoKim98 committed Sep 23, 2022
1 parent ff72809 commit 34db87f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions templates/bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,23 @@ function spawn_node() {
exit 1
fi

# Update SSH ListenAddress
"$CONTAINER_RUNTIME" exec "$name" sed -i \
"s/^\(ListenAddress\) .*\$/\1 $node_ip/g" \
/etc/ssh/sshd_config

# Restart SSH daemon
while [ ! $(
"$CONTAINER_RUNTIME" exec -it $name ps -s 1 |
awk '{print $4}' |
tail -n 1 |
grep '^systemd'
) ]; do
sleep 1
done
"$CONTAINER_RUNTIME" exec "$name" \
systemctl restart sshd 2>/dev/null || true

# Get SSH configuration
while :; do
# Get SSH port
Expand All @@ -135,23 +152,6 @@ function spawn_node() {
then
break
fi

# Update SSH ListenAddress
"$CONTAINER_RUNTIME" exec "$name" sed -i \
"s/^\(ListenAddress\) .*\$/\1 $node_ip/g" \
/etc/ssh/sshd_config

# Restart SSH daemon
while [ ! $(
"$CONTAINER_RUNTIME" exec -it $name ps -s 1 |
awk '{print $4}' |
tail -n 1 |
grep '^systemd'
) ]; do
sleep 1
done
"$CONTAINER_RUNTIME" exec "$name" \
systemctl restart sshd 2>/dev/null || true
done

# Save as environment variable
Expand Down

0 comments on commit 34db87f

Please sign in to comment.