mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-27 13:36:06 +10:00
68 lines
1.0 KiB
Bash
Executable File
68 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Monkey patch missing initctl in docker environment
|
|
|
|
fail() {
|
|
echo "$@" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
verify_args() {
|
|
if [[ "$2" != "gitlab-runsvdir" ]]; then
|
|
fail "initctl: Unknown job: $2"
|
|
fi
|
|
if [[ $# -ne 2 ]]; then
|
|
fail "usage: $0 command gitlab-runsvdir"
|
|
fi
|
|
}
|
|
|
|
proxy_gitlab_ctl() {
|
|
gitlab-ctl "$COMMAND"
|
|
}
|
|
|
|
COMMAND="$1"
|
|
shift
|
|
SERVICE="$1"
|
|
|
|
case "$COMMAND" in
|
|
start)
|
|
verify_args "$COMMAND" "$@"
|
|
RUNSVDIR=$(pidof runsvdir)
|
|
if [[ -z "$RUNSVDIR" ]]; then
|
|
/opt/gitlab/embedded/bin/runsvdir-start &
|
|
fi
|
|
;;
|
|
|
|
stop|restart)
|
|
verify_args "$COMMAND" "$@"
|
|
proxy_gitlab_ctl "$COMMAND" "$@"
|
|
;;
|
|
|
|
status)
|
|
verify_args "$COMMAND" "$@"
|
|
if [[ ! -f /etc/init/$SERVICE.conf ]]; then
|
|
fail "initctl: Unknown job: $SERVICE"
|
|
fi
|
|
|
|
RUNSVDIR=$(pidof runsvdir)
|
|
if [[ -n "$RUNSVDIR" ]]; then
|
|
echo "$SERVICE start/running, process $RUNSVDIR"
|
|
else
|
|
echo "$SERVICE stop/waiting"
|
|
fi
|
|
;;
|
|
|
|
reload)
|
|
verify_args "$COMMAND" "$@"
|
|
proxy_gitlab_ctl "hup" "$@"
|
|
;;
|
|
|
|
list)
|
|
echo "gitlab-runsvdir"
|
|
;;
|
|
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|