58 lines
1.2 KiB
Plaintext
Executable File
58 lines
1.2 KiB
Plaintext
Executable File
#!/sbin/openrc-run
|
|
|
|
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
|
|
|
|
name="monok8s-control-agent"
|
|
description="System Control Agent (OSUpgrade controller)"
|
|
|
|
supervisor=supervise-daemon
|
|
|
|
command="/usr/local/bin/ctl"
|
|
command_args="agent --env-file /opt/monok8s/config/cluster.env"
|
|
|
|
command_user="root:root"
|
|
|
|
pidfile="/run/${RC_SVCNAME}.pid"
|
|
|
|
output_log="/var/log/monok8s/agent.log"
|
|
error_log="/var/log/monok8s/agent.log"
|
|
|
|
retry="TERM/10/KILL/5"
|
|
|
|
depend() {
|
|
need localmount
|
|
after net
|
|
}
|
|
|
|
start_pre() {
|
|
checkpath --directory /run
|
|
checkpath --directory /var/log/monok8s
|
|
|
|
if [ ! -f /opt/monok8s/config/cluster.env ]; then
|
|
eerror "Missing env file: /opt/monok8s/config/cluster.env"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
start() {
|
|
ebegin "Starting monok8s control agent"
|
|
supervise-daemon "$RC_SVCNAME" \
|
|
--start \
|
|
--pidfile "$pidfile" \
|
|
--stdout "$output_log" \
|
|
--stderr "$error_log" \
|
|
--respawn-delay 5 \
|
|
--respawn-max 0 \
|
|
-- \
|
|
$command $command_args
|
|
eend $?
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping monok8s control agent"
|
|
supervise-daemon "$RC_SVCNAME" \
|
|
--stop \
|
|
--pidfile "$pidfile"
|
|
eend $?
|
|
}
|