From 3053c0cbb8c58ee6f56e56f18db586aac1ae73f6 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Fri, 8 Sep 2006 18:21:28 +0000 Subject: [PATCH] Add new slurm.conf parameter MailProg --- NEWS | 1 + doc/html/configurator.html | 1 + doc/man/man5/slurm.conf.5 | 4 ++++ slurm/slurm.h.in | 1 + src/api/config_info.c | 2 ++ src/common/read_config.c | 8 ++++++-- src/common/read_config.h | 3 +-- src/common/slurm_protocol_defs.c | 1 + src/common/slurm_protocol_pack.c | 4 ++++ src/slurmctld/agent.c | 6 ++++-- src/slurmctld/controller.c | 3 +++ src/slurmctld/proc_req.c | 1 + 12 files changed, 29 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index b7f5eacf55e..059910f3094 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ documents those changes that are of interest to users and admins. ============================= -- Remove configuration parameter ShedulerAuth (defunct). -- Add NextJobId to "scontrol show config" output. + -- Add new slurm.conf parameter MailProg. * Changes in SLURM 1.2.0-pre2 ============================= diff --git a/doc/html/configurator.html b/doc/html/configurator.html index d5e7c3c6cdd..b6a93a99b6c 100644 --- a/doc/html/configurator.html +++ b/doc/html/configurator.html @@ -72,6 +72,7 @@ function displayfile() "StateSaveLocation=" + document.config.state_save_location.value + "<br>" + "SlurmdSpoolDir=" + document.config.slurmd_spool_dir.value + "<br>" + "SwitchType=switch/" + get_radio_value(document.config.switch_type) + "<br>" + + "#MailProg=/bin/mail <br>" + "MpiDefault=" + get_radio_value(document.config.mpi_default) + "<br>" + "#MessageTimeout= <br>" + "SlurmctldPidFile=" + document.config.slurmctld_pid_file.value + "<br>" + diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index 304909d33f5..741cbff561a 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -816,6 +816,10 @@ users from directly using those resources. Possible values are "YES" and "NO". The default value is "NO". .TP +\fBMailProg\fR +Fully qualified pathname to the program used to send email per user request. +The default value is "/bin/mail". +.TP \fBMaxNodes\fR Maximum count of nodes (or base partitions for BlueGene systems) which may be allocated to any single job. diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index 40e23ac2dde..31f3bcf386e 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -704,6 +704,7 @@ typedef struct slurm_ctl_conf { char *job_comp_loc; /* job completion logging location */ uint16_t kill_wait; /* seconds between SIGXCPU to SIGKILL * on job termination */ + char *mail_prog; /* pathname of mail program */ uint16_t max_job_cnt; /* maximum number of active jobs */ uint16_t min_job_age; /* COMPLETED jobs over this age (secs) * purged from in memory records */ diff --git a/src/api/config_info.c b/src/api/config_info.c index 61dfbaa3d5a..80cd3eb9a53 100644 --- a/src/api/config_info.c +++ b/src/api/config_info.c @@ -118,6 +118,8 @@ void slurm_print_ctl_conf ( FILE* out, slurm_ctl_conf_ptr->job_credential_public_certificate); fprintf(out, "KillWait = %u\n", slurm_ctl_conf_ptr->kill_wait); + fprintf(out, "MailProg = %s\n", + slurm_ctl_conf_ptr->mail_prog); fprintf(out, "MaxJobCount = %u\n", slurm_ctl_conf_ptr->max_job_cnt); fprintf(out, "MessageTimeout = %u\n", diff --git a/src/common/read_config.c b/src/common/read_config.c index 3e6a4535523..16b5368bd15 100644 --- a/src/common/read_config.c +++ b/src/common/read_config.c @@ -1,7 +1,5 @@ /*****************************************************************************\ * read_config.c - read the overall slurm configuration file - * - * $Id$ ***************************************************************************** * Copyright (C) 2002-2006 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -148,6 +146,7 @@ s_p_options_t slurm_conf_options[] = { {"JobCredentialPublicCertificate", S_P_STRING}, {"KillTree", S_P_UINT16, defunct_option}, {"KillWait", S_P_UINT16}, + {"MailProg", S_P_STRING}, {"MaxJobCount", S_P_UINT16}, {"MessageTimeout", S_P_UINT16}, {"MinJobAge", S_P_UINT16}, @@ -919,6 +918,7 @@ free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr) xfree (ctl_conf_ptr->job_comp_type); xfree (ctl_conf_ptr->job_credential_private_key); xfree (ctl_conf_ptr->job_credential_public_certificate); + xfree (ctl_conf_ptr->mail_prog); xfree (ctl_conf_ptr->mpi_default); xfree (ctl_conf_ptr->plugindir); xfree (ctl_conf_ptr->plugstack); @@ -978,6 +978,7 @@ init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr) xfree (ctl_conf_ptr->job_credential_private_key); xfree (ctl_conf_ptr->job_credential_public_certificate); ctl_conf_ptr->kill_wait = (uint16_t) NO_VAL; + xfree (ctl_conf_ptr->mail_prog); ctl_conf_ptr->max_job_cnt = (uint16_t) NO_VAL; ctl_conf_ptr->min_job_age = (uint16_t) NO_VAL; xfree (ctl_conf_ptr->mpi_default); @@ -1341,6 +1342,9 @@ validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) if (!s_p_get_uint16(&conf->kill_wait, "KillWait", hashtbl)) conf->kill_wait = DEFAULT_KILL_WAIT; + if (!s_p_get_string(&conf->mail_prog, "MailProg", hashtbl)) + conf->mail_prog = xstrdup(DEFAULT_MAIL_PROG); + if (!s_p_get_uint16(&conf->max_job_cnt, "MaxJobCount", hashtbl)) conf->max_job_cnt = DEFAULT_MAX_JOB_COUNT; diff --git a/src/common/read_config.h b/src/common/read_config.h index 6709f5d1bdf..5f35feb9085 100644 --- a/src/common/read_config.h +++ b/src/common/read_config.h @@ -1,8 +1,6 @@ /***************************************************************************** * read_config.h - definitions for reading the overall slurm configuration * file - * - * $Id$ ***************************************************************************** * Copyright (C) 2002-2006 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -62,6 +60,7 @@ extern char *default_plugstack; #define DEFAULT_JOB_COMP_TYPE "jobcomp/none" #define DEFAULT_KILL_TREE 0 #define DEFAULT_KILL_WAIT 30 +#define DEFAULT_MAIL_PROG "/bin/mail" #define DEFAULT_MAX_JOB_COUNT 2000 #define DEFAULT_MIN_JOB_AGE 300 #define DEFAULT_MPI_DEFAULT "none" diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index 76214ad94d6..78751401dab 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -811,6 +811,7 @@ void slurm_free_ctl_conf(slurm_ctl_conf_info_msg_t * config_ptr) xfree(config_ptr->job_comp_type); xfree(config_ptr->job_credential_private_key); xfree(config_ptr->job_credential_public_certificate); + xfree(config_ptr->mail_prog); xfree(config_ptr->mpi_default); xfree(config_ptr->plugindir); xfree(config_ptr->proctrack_type); diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index 32718f4d029..d999de0b189 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -2033,6 +2033,7 @@ _pack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t * build_ptr, Buf buffer) packstr(build_ptr->job_comp_loc, buffer); packstr(build_ptr->job_comp_type, buffer); pack16((uint16_t)build_ptr->kill_wait, buffer); + packstr(build_ptr->mail_prog, buffer); pack16((uint16_t)build_ptr->max_job_cnt, buffer); pack16((uint16_t)build_ptr->min_job_age, buffer); packstr(build_ptr->mpi_default, buffer); @@ -2117,6 +2118,7 @@ _unpack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t ** safe_unpackstr_xmalloc(&build_ptr->job_comp_loc, &uint16_tmp, buffer); safe_unpackstr_xmalloc(&build_ptr->job_comp_type, &uint16_tmp, buffer); safe_unpack16(&build_ptr->kill_wait, buffer); + safe_unpackstr_xmalloc(&build_ptr->mail_prog, &uint16_tmp, buffer); safe_unpack16(&build_ptr->max_job_cnt, buffer); safe_unpack16(&build_ptr->min_job_age, buffer); safe_unpackstr_xmalloc(&build_ptr->mpi_default, &uint16_tmp, buffer); @@ -2194,6 +2196,8 @@ unpack_error: xfree(build_ptr->job_comp_type); xfree(build_ptr->job_credential_private_key); xfree(build_ptr->job_credential_public_certificate); + xfree(build_ptr->mail_prog); + xfree(build_ptr->mpi_default); xfree(build_ptr->plugindir); xfree(build_ptr->plugstack); xfree(build_ptr->proctrack_type); diff --git a/src/slurmctld/agent.c b/src/slurmctld/agent.c index 854d9ecf2c8..011048cacbc 100644 --- a/src/slurmctld/agent.c +++ b/src/slurmctld/agent.c @@ -1456,9 +1456,11 @@ static void _mail_proc(mail_info_t *mi) (void) close(pfd[1]); (void) close(1); (void) close(2); - execle("/bin/mail", "mail", mi->user_name, + execle(slurmctld_conf.mail_prog, "mail", + mi->user_name, "-s", mi->message, NULL, NULL); - error("Failed to exec /bin/mail: %m"); + error("Failed to exec %s: %m", + slurmctld_conf.mail_prog); exit(1); } else { /* parent */ (void) close(pfd[0]); diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c index fa95c1733a5..1c448122e82 100644 --- a/src/slurmctld/controller.c +++ b/src/slurmctld/controller.c @@ -172,6 +172,7 @@ int main(int argc, char *argv[]) { int error_code; pthread_attr_t thread_attr_save, thread_attr_sig, thread_attr_rpc; + struct stat stat_buf; /* * Establish initial configuration @@ -200,6 +201,8 @@ int main(int argc, char *argv[]) fatal("Can not set uid to SlurmUser(%d): %m", slurmctld_conf.slurm_user_id); } + if (stat(slurmctld_conf.mail_prog, &stat_buf) != 0) + error("Configured MailProg is invalid"); #ifndef NDEBUG # ifdef PR_SET_DUMPABLE diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c index a490b70a7b6..e733aab958a 100644 --- a/src/slurmctld/proc_req.c +++ b/src/slurmctld/proc_req.c @@ -340,6 +340,7 @@ void _fill_ctld_conf(slurm_ctl_conf_t * conf_ptr) conf_ptr->job_credential_public_certificate = xstrdup(conf-> job_credential_public_certificate); conf_ptr->kill_wait = conf->kill_wait; + conf_ptr->mail_prog = xstrdup(conf->mail_prog); conf_ptr->max_job_cnt = conf->max_job_cnt; conf_ptr->min_job_age = conf->min_job_age; conf_ptr->mpi_default = xstrdup(conf->mpi_default); -- GitLab