Closed schonert closed 1 month ago
This is my current solution. wondering if there's a built in
[ ! -S .overmind.sock ] && overmind s || echo 'overmind already running'
./.overmind.sock
is a Unix socket used by Overmind to receive commands like restart
, connect
, etc. It's safe to remove it if you're sure that you don't have Overmind running. Otherwise running Overmind won't be able to receive commands.
I've just thought that this would be useful to check if the socket is actually in use rather than it just exists 🤔
FWIW, I put rm -f ".overmind.sock"
in my bin/dev
so that Overmind starts even after the IDE crashes or was restarted.
Here's the whole file:
#!/usr/bin/env sh
# Setup ENV vars from .env.local
if [ -f .env.local ]
then
while read -r LINE; do
if [[ $LINE == *'='* ]] && [[ $LINE != '#'* ]]; then
ENV_VAR="$(echo $LINE | envsubst)"
eval "declare $ENV_VAR"
fi
done < .env.local
fi
# Ensure default port ENV is set
PORT="${PORT:-3000}"
export PORT
# Ensure required dependencies are present, useful when switching branches
bundle check &> /dev/null || bundle install
yarn check &> /dev/null || yarn install
# Try starting Overmind
if command -v overmind &> /dev/null; then
# Remove dangling socks from overmind
rm -f ".overmind.sock"
exec overmind start -f Procfile.dev --no-port "$@"
else # Fallback to Foreman
exec foreman start -f Procfile.dev --no-port "$@"
fi
Is there a way to tame the error when starting overmind while the session is already running?