Skip to content

Commit

Permalink
Merge pull request #5 from ocurrent/shon/infra487/run-worker-in-daemon
Browse files Browse the repository at this point in the history
Run the worker process via `daemon`
  • Loading branch information
mtelvers authored May 22, 2024
2 parents ce10e02 + d089011 commit ed2241c
Showing 1 changed file with 11 additions and 2 deletions.
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"

0 comments on commit ed2241c

Please sign in to comment.