Skip to content

Instantly share code, notes, and snippets.

@nheine
Created October 23, 2013 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nheine/7110844 to your computer and use it in GitHub Desktop.
Save nheine/7110844 to your computer and use it in GitHub Desktop.
gentoo init.d script for gitlab 6.2
#!/sbin/runscript
# GitLab 6.2 init script for Gentoo Linux
GITLAB_BASE=/home/git/gitlab
GITLAB_USER=git
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 \
--pidfile "${GITLAB_BASE}/tmp/pids/unicorn.pid" \
--exec "${GITLAB_BASE}/script/web" -- start
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 "${GITLAB_BASE}/script/background_jobs" -- start
eend $?
}
stop() {
ebegin "Stopping gitlab sidekiq"
start-stop-daemon --stop \
--chdir "${GITLAB_BASE}/" \
--user "${GITLAB_USER}" \
--pidfile "${GITLAB_BASE}/tmp/pids/sidekiq.pid" \
--env RAILS_ENV=production \
--exec "${GITLAB_BASE}/script/background_jobs" -- stop
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" \
--env RAILS_ENV=production \
--exec "${GITLAB_BASE}/script/web" -- stop
eend $?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment