39 lines
933 B
Text
39 lines
933 B
Text
|
#!/sbin/openrc-run
|
||
|
|
||
|
description="Forgejo CI Runner"
|
||
|
name="Forgejo Runner"
|
||
|
|
||
|
: ${cfgfile:="/etc/forgejo-runner/config.yaml"}
|
||
|
: ${datadir:="/var/lib/forgejo-runner"}
|
||
|
: ${command_user:="forgejo-runner"}
|
||
|
|
||
|
command="/usr/bin/forgejo-runner"
|
||
|
command_args="daemon --config $cfgfile"
|
||
|
command_background="yes"
|
||
|
directory="$datadir"
|
||
|
pidfile="/run/$RC_SVCNAME.pid"
|
||
|
|
||
|
depend() {
|
||
|
need net
|
||
|
use dns logger
|
||
|
}
|
||
|
|
||
|
start_pre() {
|
||
|
checkpath -d -o "$command_user" /etc/forgejo-runner
|
||
|
checkpath -d -o "$command_user" "$datadir"
|
||
|
|
||
|
if ! [ -e "$cfgfile" ]; then
|
||
|
eerror "Config file $cfgfile doesn't exist."
|
||
|
eerror "You can generate it with: forgejo-runner generate-config,"
|
||
|
eerror "or use the auto-generated one in /etc/forgejo-runner/config.example.yaml"
|
||
|
return 1
|
||
|
fi
|
||
|
|
||
|
if [ "$error_log" ]; then
|
||
|
output_log="$error_log"
|
||
|
else
|
||
|
output_logger="logger -t '${RC_SVCNAME}' -p daemon.info"
|
||
|
error_logger="logger -t '${RC_SVCNAME}' -p daemon.error"
|
||
|
fi
|
||
|
}
|