Skip to content

Instantly share code, notes, and snippets.

@suda
Created October 23, 2021 19:31
Show Gist options
  • Save suda/ba2fc6602239b15689aa79aa58ed998f to your computer and use it in GitHub Desktop.
Save suda/ba2fc6602239b15689aa79aa58ed998f to your computer and use it in GitHub Desktop.
#!/bin/sh
# PROVIDE: gitlab_runner
# REQUIRE: DAEMON NETWORKING
# BEFORE:
# KEYWORD:
. /etc/rc.subr
name="gitlab_runner"
rcvar="gitlab_runner_enable"
user="gitlab-runner"
user_home="/home/gitlab-runner"
command="/usr/local/bin/gitlab-runner"
command_args="run"
pidfile="/var/run/${name}.pid"
start_cmd="gitlab_runner_start"
gitlab_runner_start()
{
export USER=${user}
export HOME=${user_home}
if checkyesno ${rcvar}; then
cd ${user_home}
/usr/sbin/daemon -u ${user} -p ${pidfile} ${command} ${command_args} > /var/log/gitlab_runner.log 2>&1
fi
}
load_rc_config $name
run_rc_command $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment