Independent of the preceding message we also had a user ticket which concerned
counter-intuitive behaviour of interactive salloc sessions: when the session
ended due to scancel or timeout, the user would still be left in the shell (or
the SallocDefaultCommand), and would have to CTL-D out of it.
Since this is in fact unclean termination, I would like to submit
Patch #2: set the default termination signal to SIGHUP on interactive sessions
The SIGHUP signal is caught by the shell, we tested that on our systems
(confirmed by the user opening the ticket). The user can still, as before,
override this using the -K/--kill-command option.
salloc: terminate shell on exit
This sets the default termination signal to SIGHUP for interactive sessions, so
that the shell is automatically terminated, which is a more intuitive behaviour
for interactive sessions.
---
doc/man/man1/salloc.1 | 3 ++-
src/salloc/salloc.c | 7 +++----
2 files changed, 5 insertions(+), 5 deletions(-)
--- a/src/salloc/salloc.c
+++ b/src/salloc/salloc.c
@@ -825,13 +825,12 @@ static void _job_complete_handler(srun_j
*/
if (tpgid != command_pid && tpgid != getpgrp())
killpg(tpgid, SIGHUP);
+ signal = SIGHUP;
}
-#ifdef HAVE_CRAY
- signal = SIGTERM;
-#else
+
if (opt.kill_command_signal_set)
signal = opt.kill_command_signal;
-#endif
+
if (signal) {
verbose("Sending signal %d to command \"%s\","
" pid %d",
--- a/doc/man/man1/salloc.1
+++ b/doc/man/man1/salloc.1
@@ -452,7 +452,8 @@ your command any time that the SLURM con
allocation has been revoked. The job allocation can be revoked for a
couple of reasons: someone used \fBscancel\fR to revoke the allocation,
or the allocation reached its time limit. If you do not specify a signal
-name or number, the default signal is SIGTERM.
+name or number, the default signal is SIGHUP for interactive and SIGTERM
+for non-interactive sessions.
.TP
\fB\-k\fR, \fB\-\-no\-kill\fR