Created
September 22, 2023 21:24
-
-
Save RenatoRosaFranco/d22ef0f211ac720ad21b21000a7f1e7e to your computer and use it in GitHub Desktop.
server.sh for Makefile as prof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f tmp/pids/server.pid ]; then | |
rm tmp/pids/server.pid | |
fi | |
for n in {1..6}; do | |
(bundle exec rails db:migrate || | |
echo "Database setup/migration failed. Retry in 10s...") && break | |
sleep 10 | |
done | |
if [[ $RAILS_ENV = "development" ]]; then | |
bundle exec rails s -b 0.0.0.0 | |
sleep 20 | |
else | |
bundle exec rails s -b 0.0.0.0 -e "$RAILS_ENV" -p 3000 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment