#!/bin/bash set -e echo "1: ${1}" echo "2: ${2}" if [ -f tmp/pids/server.pid ]; then rm tmp/pids/server.pid fi # Make the if statement match any invocation of the "rails server" command if [[ "${1}" == *rails ]] && ([ "${2}" == "server" ] || [ "${2}" == "s" ]); then if [ ! -f /app/no_migrate ] && [ ! -v NO_MIGRATE ]; then echo "+ preparing database..." ./bin/rails db:prepare echo "- preparing database done." fi fi # Execute the given or default command: exec "${@}"