gentoo-overlay/www-apps/gitlab-ce/files/gitlab-8.13.3-sidekiq.init

63 lines
1.4 KiB
Text
Raw Normal View History

#!/sbin/openrc-run
extra_started_commands="check"
name="GitLab Sidekiq"
description="Sidekiq for GitLab"
description_check="Runs sanity checks"
: ${gitlab_user:=@USER@}
: ${gitlab_base:="@GITLAB_BASE@"}
: ${rails_env:=production}
: ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"}
: ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"}
: ${sidekiq_config:="/etc/gitlab/sidekiq_queues.yml"}
sidekiq_command="/usr/bin/bundle"
sidekiq_command_args="exec sidekiq -C ${sidekiq_config} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"
check_command="sudo -u ${gitlab_user} -H /usr/bin/bundle"
check_command_args1="exec rake gitlab:env:info RAILS_ENV=${rails_env}"
check_command_args2="exec rake gitlab:check RAILS_ENV=${rails_env}"
depend() {
need redis gitlab-workhorse
use net
}
start() {
checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")"
ebegin "Starting ${name} - Sidekiq"
start-stop-daemon --start \
--background --quiet \
--chdir "${gitlab_base}" \
--user=${gitlab_user} \
--pidfile="${sidekiq_pidfile}" \
--env RAILS_ENV=${rails_env} \
--exec ${sidekiq_command} -- ${sidekiq_command_args}
eend $?
}
stop() {
ebegin "Stopping ${name} - Sidekiq"
start-stop-daemon --stop \
--pidfile=${sidekiq_pidfile} \
--exec ${sidekiq_command}
eend $?
}
check() {
ebegin "Running sanity checks for ${name}"
${check_command} ${check_command_aregs1}
eend $?
${check_command} ${check_command_aregs2}
eend$?
}