diff options
author | Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> | 2014-02-18 22:16:18 +0100 |
---|---|---|
committer | Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> | 2014-02-20 16:23:51 +0100 |
commit | b2abce92fbed264229d44ae23b6528b3fb2f3256 (patch) | |
tree | 1d062f2c0853f25165505aa97d006e6b47efb3e0 /script/web | |
parent | 30091a6622ec705a97c1173585a7bb0c4f0ae332 (diff) | |
download | gitlab-ci-b2abce92fbed264229d44ae23b6528b3fb2f3256.tar.gz |
Added the new init.d script
Diffstat (limited to 'script/web')
-rwxr-xr-x | script/web | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/script/web b/script/web new file mode 100755 index 0000000..5464ed0 --- /dev/null +++ b/script/web @@ -0,0 +1,49 @@ +#!/bin/bash + +cd $(dirname $0)/.. +app_root=$(pwd) + +unicorn_pidfile="$app_root/tmp/pids/unicorn.pid" +unicorn_config="$app_root/config/unicorn.rb" + +function get_unicorn_pid +{ + local pid=$(cat $unicorn_pidfile) + if [ -z $pid ] ; then + echo "Could not find a PID in $unicorn_pidfile" + exit 1 + fi + unicorn_pid=$pid +} + +function start +{ + bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV +} + +function stop +{ + get_unicorn_pid + kill -QUIT $unicorn_pid +} + +function reload +{ + get_unicorn_pid + kill -USR2 $unicorn_pid +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + reload) + reload + ;; + *) + echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}" + ;; +esac |