Summary Modernize and harden the slurmctld and slurmd rc.d services: - Make the configuration file path configurable via rc.conf (default to %%ETCDIR%%/slurm.conf). - Add configurable log directory and pidfile locations; run via daemon(8) by default. - Implement robust status (and onestop) using pidfiles/rc.subr. - Review & remove outdated bits; align defaults with current port (--sysconfdir=%%ETCDIR%%). - Preserve backwards compatibility with existing *_flags and SLURM_CONF. Motivation / Why now - The port now installs config under %%ETCDIR%%; rc.d should reflect that and allow overrides. - Current scripts lack a proper status and don’t consistently manage pidfiles/logging. - Users expect rc.d services to support configurable paths without editing scripts. Scope of change - Files: files/slurmctld.in and files/slurmd.in - No ABI/API change; rc knobs only. - Defaults safe for fresh installs; compatible with existing deployments. Proposed rc variables (defaults) # Common (both services honour these) slurm_user="slurm" slurm_group="slurm" slurm_conf="%%ETCDIR%%/slurm.conf" # exported as SLURM_CONF slurm_logdir="/var/log/slurm" # created with 0750/slurm:slurm slurm_rundir="/var/run/slurm" # created with 0755/root:wheel # Service-specific (overridable) slurmctld_enable="NO" slurmctld_flags="" # extra args slurmctld_pidfile="/var/run/slurm/slurmctld.pid" slurmctld_logfile="/var/log/slurm/slurmctld.log" slurmd_enable="NO" slurmd_flags="" slurmd_pidfile="/var/run/slurm/slurmd.pid" slurmd_logfile="/var/log/slurm/slurmd.log" Behavioural details - start: create run/log dirs, ensure ownership, export SLURM_CONF="${slurm_conf}", start via daemon(8) with -P <pidfile> -o <logfile> -r. - status: use rc_subr pidfile helpers (status_cmd="${name}_status" with check_pidfile). - stop: stop_postcmd verifies pidfile removal; fall back to pkill -F if needed. - reload: send HUP to daemon pid (both daemons support SIGHUP to re-read config). - Backward compatible: existing slurm_*_flags still honoured; SLURM_CONF can be set globally in /etc/rc.conf or environment—rc script exports it from slurm_conf if not already set.
Can you create patch against current ports tree.
Created attachment 265625 [details] Modernize slurm's rc.d scripts Created a patch against the current ports tree to modernize the slurmctld and slurmd rc.d scripts. The updated scripts: - Add rc.conf knobs for slurm_conf, log directory, run directory, pidfile, and logfile paths. - Run slurmctld and slurmd via daemon(8) in foreground mode (-D) for predictable pidfile and log handling. - Implement status and reload using pidfiles and rc.subr helpers, instead of ad-hoc logic. - Ensure log/run directories are created with appropriate ownership and permissions (slurm:slurm for logs, root:wheel for run). - Improve stop handling to avoid leaving stray helper processes behind after restarts. - Preserve compatibility with existing slurm*_flags and SLURM_CONF configuration. I tested: - Starting/stopping/restarting both services, including status and reload, and verified they act on the correct PIDs. - Overriding all new rc.conf knobs (paths for config, logs, pidfiles, rundir) and confirmed the services honour them. - Bringing up a minimal controller + worker setup to confirm that the updated rc.d scripts do not interfere with normal Slurm operation.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=dbb76b3a6836ad106df7fb4a99753ef55fed939b commit dbb76b3a6836ad106df7fb4a99753ef55fed939b Author: Generic Rikka <rikka.goering@outlook.de> AuthorDate: 2025-11-26 18:27:56 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2025-11-26 18:29:59 +0000 sysutils/slurm-wlm: Improve rc.d scripts - Add rc.conf knobs for slurm_conf, logdir, rundir, pidfile and logfile paths - Run slurmctld and slurmd under daemon(8) in foreground mode (-D) - Implement status/reload using pidfiles and procname via rc.subr helpers - Create log/run directories with appropriate ownership and permissions - Ensure clean shutdown and avoid stray helper processes across restarts - Preserve compatibility with existing *_flags and SLURM_CONF settings PR: 290211 sysutils/slurm-wlm/Makefile | 1 + sysutils/slurm-wlm/files/slurmctld.in | 133 +++++++++++++++++++++++++++++----- sysutils/slurm-wlm/files/slurmd.in | 111 +++++++++++++++++++++++----- 3 files changed, 209 insertions(+), 36 deletions(-)
Thanks.