SUMMARY: Killing in a friendly way

From: Torsten Lif (etxorst@eos.ericsson.se)
Date: Mon Aug 24 1992 - 10:43:30 CDT


Last week, in a question to sun_managers, I asked for advice on how to
put a remote user's job into the background so that I'd be able to
re-boot a machine he was logged on through without terminating his jobs
on another host.

As usual, sun_managers came up with a flood of answers within hours.
Thanks to all you guys!

The answers fell mainly into 3 categories:

I) Send a kill -STOP followed by a kill -CONT to his job, then send a
   kill -9 to his shell.

   Problems: "Due to a design flaw in UNIX job control, the shell will
              not be aware that the process has been resumed. Some
              shells don't deal with this well, and will refuse to send
              another STOP signal to a process that it believes is
              already stopped!"

II) Get the "screens" package and have him run through this. That way,
    his jobs can be resumed "seamlessly" after the re-boot.

    Problem: requires the advance co-operation of the user...

III) Use ioctl to "inject" data into the ptty's streams as if they came
     from the user. Send ^Zbg^J and watch the process background...

     Problems: Kind of nasty...

In addition there was a single message with the following:

IV) Use setpgrp(2) to change the pgrp of the processes and keep them
    from dying when the parent does..

    Problem: Waaay above my current level of expertise...

The II) or IV) solutions are obviously the pretty ones but in a
situation like the one that prompted my request, I'd have to resort to
either of I) or III). Both should work, though III) may be more general
than I). Both require that he run some csh-like shell. In either case
one has to look out for processes that may hang because they lack
stdin/out.

Thanks to:

"Dan Franklin" <dan@diamond.bbn.com>
David Beard <beard@abel.maths.adelaide.edu.au>
Dieter Muller <dworkin@merlin.rootgroup.com>
Gustavo Vegas <gustavo@davinci.concordia.ca>
Mark Ferraretto <mferrare@physics.adelaide.edu.au>
ake@cs.umu.se (]ke Sandgren)
bit!jayl@Sun.COM (Jay Lessert)
cp_baker@pnl.gov
epkakeh@kaepk2 (Ake Hjalmarsson)
jdschn@nicsn1.monsanto.com (John D Schneider)
katzung@sbcoc.com (Brian Katzung)
keener@upenn5.hep.upenn.edu (Paul T. Keener)
kevins@kuma3.Japan.Sun.COM (Kevin Sheehan {Consulting Poster Child})
matthew@cs.adelaide.edu.au (Matthew Donaldson)

plus the one guy who requested that I not post his name and any others
whose messages may still be in the pipe-line.

---
 Torsten Lif
 Ericsson Telecom AB, EO/ETX/TX/AD
 S-126 25  STOCKHOLM, SWEDEN
 Phone: +46 8 719 4881



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:48 CDT