Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 44 lines (39 sloc) 1.1 KB
#!/usr/bin/env bash
#
# Unicorn
#
master_pid="$(ps auxww | grep '[u]nicorn' | grep 'master' | awk '/'${project}'/{print $2}')"
builtin cd $current_path
if [[ "$start_flag" -eq 1 ]] ; then
unicorn_rails -c $current_path/config/unicorn.rb -E $RAILS_ENV -D
if [[ "$master_pid" -gt 0 ]] ; then
sleep 1 ; kill -QUIT $master_pid
fi
return $?
elif [[ "$master_pid" -le 0 ]] ; then
echo "unicorn is not running for $project yet."
return 1
elif [[ "$stop_flag" -eq 1 ]] || [[ "$graceful_flag" -eq 1 ]] ; then
kill -QUIT $master_pid
elif [[ "$restart_flag" -eq 1 ]] ; then
kill -USR2 $master_pid
sleep 5
kill -QUIT $master_pid
elif [[ "$pause_flag" -eq 1 ]] ; then
kill -WINCH $master_pid
elif [[ "$unpause_flag" -eq 1 ]] ; then
kill -WINCH $master_pid
elif [[ "$kill_flag" -eq 1 ]] ; then
kill -TERM $master_pid
elif [[ "$increase_flag" -eq 1 ]] ; then
kill -TTOU $master_pid
elif [[ "$decrease_flag" -eq 1 ]] ; then
kill -TTOU $master_pid
elif [[ "$logs_flag" -eq 1 ]] ; then
kill -USR1 $master_pid
elif [[ "$reload_flag" -eq 1 ]] ; then
kill -HUP $master_pid
else
:
fi
exit $?
Something went wrong with that request. Please try again.