3 # gitlab-unicorn gitlab-unicorn short service description
6 # description: Runs unicorn
9 # Related (kudos @4sak3n0ne):
10 # https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882
11 # https://gist.github.com/3062860
13 # Source function library
14 . /etc/rc.d/init.d/functions
17 . /etc/sysconfig/network
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
22 msg_network_down "GitLab Unicorn"
29 ### Environment variables
30 RAILS_ENV="production"
32 # The username and path to the gitlab source
34 APP_PATH=/var/lib/gitlab
36 # The PID and LOCK files used by unicorn and sidekiq
37 pidfile=$APP_PATH/tmp/pids/unicorn.pid
38 lockfile=/var/lock/subsys/gitlab-unicorn
40 # Get service config - may override defaults
41 [ -f /etc/sysconfig/gitlab-unicorn ] && . /etc/sysconfig/gitlab-unicorn
44 # Check if the service is already running?
45 if [ -f $lockfile ]; then
46 msg_already_running "GitLab Unicorn"
50 msg_starting "GitLab Unicorn"
51 daemon --pidfile $pidfile --user $USER --chdir "$APP_PATH" \
52 "env RAILS_ENV=$RAILS_ENV bin/web start"
54 [ $RETVAL -eq 0 ] && touch $lockfile
58 if [ ! -f $lockfile ]; then
59 msg_not_running "GitLab Unicorn"
64 msg_stopping "GitLab Unicorn"
65 killproc --pidfile $pidfile unicorn
70 if [ ! -f $lockfile ]; then
71 msg_not_running "GitLab Unicorn"
81 # See how we were called.
100 status --pidfile $pidfile unicorn_rails
104 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"