diff --git a/src/srun/opt.c b/src/srun/opt.c index cd7169da9d586190df34a5c0210066b96c28d750..022cc408de7d3459b4c76442e4a745c4dd292fe8 100644 --- a/src/srun/opt.c +++ b/src/srun/opt.c @@ -1688,10 +1688,17 @@ static void _opt_args(int argc, char **argv) opt.argv[i++] = xstrdup(":"); /* Sanity check to make sure we set it up correctly. */ - if (i != command_pos) + if (i != command_pos) { fatal ("command_pos is set to %d but we are going to put " "it at %d, please update src/srun/opt.c", command_pos, i); + } + + /* Set default job name to the executable name rather than "runjob" */ + if (!opt.job_name_set_cmd && (command_pos < opt.argc)) { + opt.job_name_set_cmd = true; + opt.job_name = xstrdup(rest[0]); + } #endif for (i = command_pos; i < opt.argc; i++) opt.argv[i] = xstrdup(rest[i-command_pos]);