Skip to content

updated fsx_ubuntu.sh script with wait loop #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
#!/bin/bash

# Wait for FSx to be properly mounted (timeout after 60 seconds)
ATTEMPTS=6
WAIT=10
for ((i=1; i<=ATTEMPTS; i++)); do
if mountpoint -q "/fsx" && touch /fsx/.test_write 2>/dev/null; then
rm -f /fsx/.test_write
break
fi
if [ $i -eq $ATTEMPTS ]; then
echo "FSx mount not ready after $((ATTEMPTS * WAIT)) seconds"
exit 1
fi
sleep $WAIT
done

# move the ubuntu user to the shared /fsx filesystem
if [ -d "/fsx/ubuntu" ]; then
sudo usermod -d /fsx/ubuntu ubuntu
elif [ -d "/fsx" ]; then
sudo usermod -m -d /fsx/ubuntu ubuntu
fi
fi