-
-
Save miguelitosd/dea48b1262f341135b4b to your computer and use it in GitHub Desktop.
GitLab initscript for 6-0
This file contains 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
#!/sbin/runscript | |
# GitLab 5.2 and 5.3 init script for Gentoo Linux | |
# see https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md | |
GITLAB_BASE=/home/git/gitlab | |
GITLAB_USER=git | |
#### | |
# Assumes variables set in /etc/default/gitlab.. | |
# app_user app_root socket_path gitlab_git_http_server_options gitlab_git_http_server_repo_root gitlab_git_http_server_log | |
#### | |
[[ -f /etc/default/gitlab ]] && . /etc/default/gitlab | |
depend() { | |
need net redis | |
} | |
start() { | |
ebegin "Starting gitlab unicorn server" | |
[[ -d ${GITLAB_BASE}/tmp/pids ]] || su $GITLAB_USER -c "mkdir -p ${GITLAB_BASE}/tmp/pids" | |
start-stop-daemon --start \ | |
--chdir "${GITLAB_BASE}" \ | |
--user "${GITLAB_USER}" \ | |
--background \ | |
--env RAILS_ENV=production \ | |
--exec bundle -- exec unicorn_rails -c ${GITLAB_BASE}/config/unicorn.rb -E production | |
eend $? | |
ebegin "Starting gitlab sidekiq" | |
start-stop-daemon --start \ | |
--chdir "${GITLAB_BASE}" \ | |
--user "${GITLAB_USER}" \ | |
--pidfile "${GITLAB_BASE}/tmp/pids/sidekiq.pid" \ | |
--background \ | |
--env RAILS_ENV=production \ | |
--exec bundle -- exec rake sidekiq:start | |
eend $? | |
if [ -n "$gitlab_git_http_server_options" ] | |
then | |
ebegin "Starting gitlab-git-http-server" | |
start-stop-daemon --start \ | |
--chdir "${GITLAB_BASE}" \ | |
--user "${GITLAB_USER}" \ | |
--make-pidfile \ | |
--pidfile "${GITLAB_BASE}/tmp/pids/gitlab-git-http-server.pid" \ | |
--background \ | |
--exec /bin/bash -- -c "${GITLAB_BASE}/../gitlab-git-http-server/gitlab-git-http-server $gitlab_git_http_server_options $gitlab_git_http_server_repo_root >> $gitlab_git_http_server_log 2>&1" | |
eend $? | |
fi | |
if [ "$mail_room_enabled" = "true" ] | |
then | |
ebegin "Starting mail_room" | |
start-stop-daemon --start \ | |
--chdir "${GITLAB_BASE}" \ | |
--user "${GITLAB_USER}" \ | |
--pidfile "${GITLAB_BASE}/tmp/pids/mail_room.pid" \ | |
--background \ | |
--env RAILS_ENV=production \ | |
--exec /bin/bash -- -c "${GITLAB_BASE}/bin/mail_room start" | |
eend $? | |
fi | |
} | |
stop() { | |
ebegin "Stopping gitlab sidekiq" | |
start-stop-daemon --stop \ | |
--chdir "${GITLAB_BASE}" \ | |
--user "${GITLAB_USER}" \ | |
--pidfile "${GITLAB_BASE}/tmp/pids/sidekiq.pid" | |
eend $? | |
ebegin "Stopping gitlab unicorn server" | |
start-stop-daemon --stop \ | |
--chdir "${GITLAB_BASE}" \ | |
--user "${GITLAB_USER}" \ | |
--signal QUIT \ | |
--pidfile "${GITLAB_BASE}/tmp/pids/unicorn.pid" | |
if [ "$mail_room_enabled" = "true" ] | |
then | |
ebegin "Stopping gitlab-git-http-server" | |
kill -TERM $(pidof gitlab-git-http-server) | |
eend $? | |
fi | |
if [ -f ${GITLAB_BASE}/tmp/pids/mail_room.pid ] | |
then | |
ebegin "Stopping mail_room" | |
start-stop-daemon --stop \ | |
--chdir "${GITLAB_BASE}" \ | |
--user "${GITLAB_USER}" \ | |
--pidfile "${GITLAB_BASE}/tmp/pids/mail_room.pid" | |
eend $? | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment