Skip to content

Instantly share code, notes, and snippets.

@maca
Forked from nheine/gitlab-ci
Last active April 8, 2018 02:15
Show Gist options
  • Save maca/479d013cd2bbc427b647 to your computer and use it in GitHub Desktop.
Save maca/479d013cd2bbc427b647 to your computer and use it in GitHub Desktop.
#!/sbin/runscript
# GitLab-CI 4.3 init script for Gentoo Linux
GITLAB_BASE=/home/gitlab_ci/gitlab-ci
GITLAB_USER=gitlab_ci
depend() {
need net redis
}
start() {
ebegin "Starting gitlab-ci 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