Created
March 10, 2012 01:46
-
-
Save damien/2009676 to your computer and use it in GitHub Desktop.
start function from unicorn init.d script
This file contains hidden or 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 | |
unicorn_start() { | |
if ! unicorn_is_running ; then | |
echo "Unicorn Starting, Type: ${APP_TYPE} interface, App Name: ${application}" | |
if [[ $APP_TYPE == "rails" ]] ; then | |
bundle exec $UNICORN_EXEC -E $RAILS_ENV -c $UNICORN_CONF -D | |
unicorn_status=$? | |
else | |
bundle exec $UNICORN_EXEC -E $RACK_ENV -c $UNICORN_CONF -D /data/${application}/current/config.ru | |
unicorn_status=$? | |
fi | |
if [ ${unicorn_status} == "1" ] ; then | |
display_logs | |
echo "There was a problem starting unicorn displaying log files:" | |
exit 1 | |
fi | |
else | |
printf "\nUnicorn master is already running with:" | |
printf "\n pid: $master_pid" | |
printf "\n name: $process_name " | |
printf "\n cwd: $application_name" | |
return 0 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment