From 23ef4fde21c1328a28bdd9403fc5acc5ca3015c7 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 8 Dec 2003 18:52:58 +0000 Subject: [PATCH] Re-read the slurm.conf file with every slurmctld communication if the configuration file has changed (important for long-running jobs, especially DPCS daemons). --- src/common/slurm_protocol_api.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c index f99eb2630a2..d16011e0984 100644 --- a/src/common/slurm_protocol_api.c +++ b/src/common/slurm_protocol_api.c @@ -39,7 +39,10 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/stat.h> +#include <sys/types.h> #include <time.h> +#include <unistd.h> /* PROJECT INCLUDES */ #include "src/common/macros.h" @@ -103,12 +106,22 @@ slurm_protocol_config_t *slurm_get_api_config() int slurm_api_set_default_config() { int rc = SLURM_SUCCESS; + struct stat config_stat; + static time_t last_config_update = (time_t) 0; slurm_mutex_lock(&config_lock); - if ((slurmctld_conf.control_addr != NULL) && + if (stat(SLURM_CONFIG_FILE, &config_stat) < 0) { + error("Can't stat %s: %m", SLURM_CONFIG_FILE); + rc =SLURM_ERROR; + goto cleanup; + } + if ((last_config_update == config_stat.st_mtime) && + (slurmctld_conf.control_addr != NULL) && (slurmctld_conf.slurmctld_port != 0)) goto cleanup; + last_config_update = config_stat.st_mtime; + free_slurm_conf(&slurmctld_conf); read_slurm_conf_ctl(&slurmctld_conf); if ((slurmctld_conf.control_addr == NULL) || -- GitLab