Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the worker process via daemon #5

Merged
merged 2 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions roles/ocluster/templates/worker
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@
. /etc/rc.subr

name=worker
title=ocluster_worker # Title of the process
# The command to invoke the worker process
worker_command="/usr/local/bin/${name} --connect /etc/ocluster/pool.cap --name {{ inventory_hostname_short }} --state-dir /obuilder/state --obuilder-store zfs:obuilder --obuilder-healthcheck 0 --obuilder-prune-threshold=25 --capacity={{ capacity }} -v"

rcvar=worker_enable

PATH=$PATH:/usr/local/bin
export PATH

command="/usr/local/bin/${name}"
command_args="--connect /etc/ocluster/pool.cap --name {{ inventory_hostname_short }} --state-dir /obuilder/state --obuilder-store zfs:obuilder --obuilder-healthcheck 0 --obuilder-prune-threshold=25 --capacity={{ capacity }} -v 2>&1 | logger &"
# `daemon` will run the worker process
command="/usr/sbin/daemon"
# --restart-delay : Supervise and restart the program after the specified seconds of delay if it has been terminated.
# --syslog : direct stdout and stderr to the syslog
# --title : the name to give the process
# See https://man.freebsd.org/cgi/man.cgi?daemon(8)
command_args="--restart-delay 60 --syslog --title ${title} ${worker_command}"

load_rc_config $name
run_rc_command "$1"