32 lines
1.0 KiB
Plaintext
Executable File
32 lines
1.0 KiB
Plaintext
Executable File
#!/sbin/openrc-run
|
|
# One service of the prain stack, picked by the link name: prain.vllm, prain.web, ...
|
|
# What it runs and what must already run come from prain.conf (`prain run NAME`,
|
|
# `prain deps NAME`); supervision settings and start order from conf.d/prain.NAME
|
|
# (respawn_max, respawn_period, respawn_delay, rc_after).
|
|
|
|
stack_name=${RC_SVCNAME#prain.}
|
|
description="prain stack: ${stack_name}"
|
|
supervisor=supervise-daemon
|
|
command=${prain_bin:-$HOME/.local/bin/prain}
|
|
command_args="run ${stack_name}"
|
|
respawn_delay=${respawn_delay:-5}
|
|
respawn_max=${respawn_max:-3}
|
|
respawn_period=${respawn_period:-600}
|
|
output_log=${XDG_STATE_HOME:-$HOME/.local/state}/prain/${stack_name}.log
|
|
error_log=${output_log}
|
|
|
|
start_pre() {
|
|
if [ "${RC_SVCNAME}" = prain ]; then
|
|
eerror "Start a link to this script, like prain.vllm"
|
|
return 1
|
|
fi
|
|
checkpath -d "${output_log%/*}"
|
|
"${command}" deps "${stack_name}" # requires_NAME in prain.conf: refuse, never start them
|
|
}
|
|
|
|
start_post() {
|
|
ebegin "Waiting until ${stack_name} is ready"
|
|
"${command}" wait "${stack_name}"
|
|
eend $?
|
|
}
|