Skip to content

Instantly share code, notes, and snippets.

@damien
Created March 10, 2012 01:46
Show Gist options
  • Save damien/2009676 to your computer and use it in GitHub Desktop.
Save damien/2009676 to your computer and use it in GitHub Desktop.
start function from unicorn init.d script
#!/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