The following patch makes the setsid() call optional, controlled by the --new-session option.
--- a/run-parts.8 +++ b/run-parts.8 @@ -70,6 +70,11 @@ .B \-\-lsbsysinit use LSB namespaces instead of classical behavior. .TP +.B \-\-new\-session +run each script in a separate process session. If you use this option, +killing run-parts will not kill the currently running script, it will +run until completion. +.TP .BI \-\-regex= RE validate filenames against custom extended regular expression .IR RE . --- a/run-parts.c +++ b/run-parts.c @@ -43,6 +43,7 @@ int exitstatus = 0; int regex_mode = 0; int exit_on_error_mode = 0; +int new_session_mode = 0; int argcount = 0, argsize = 0; char **args = 0; @@ -87,6 +88,7 @@ " --exit-on-error exit as soon as a script returns with a non-zero exit\n" " code.\n" " --lsbsysinit validate filenames based on LSB sysinit specs.\n" + " --new-session run each script in a separate process session\n" " --regex=PATTERN validate filenames based on POSIX ERE pattern PATTERN.\n" " -u, --umask=UMASK sets umask to UMASK (octal), default is 022.\n" " -a, --arg=ARGUMENT pass ARGUMENT to scripts, use once for each argument.\n" @@ -184,7 +186,8 @@ exit(1); } else if (!pid) { - setsid(); + if (new_session_mode) + setsid(); if (report_mode) { if (dup2(pout[1], STDOUT_FILENO) == -1 || dup2(perr[1], STDERR_FILENO) == -1) { @@ -410,6 +413,7 @@ {"lsbsysinit", 0, ®ex_mode, RUNPARTS_LSBSYSINIT}, {"regex", 1, ®ex_mode, RUNPARTS_ERE}, {"exit-on-error", 0, &exit_on_error_mode, 1}, + {"new-session", 0, &new_session_mode, 1}, {0, 0, 0, 0} }; -- ,''`. : :' : Romain Francoise <[EMAIL PROTECTED]> `. `' http://people.debian.org/~rfrancoise/ `- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]