[comp.sys.apollo] Keeping DM from killing process at logout

mth@cci632.cci.com (Michael Hickman) (04/16/91)

I have written a program in PERL that forks daemon process.  I have the
daemon process do a ioctl(TTY, &TIOCNOTTY, 0), and even give it a unique
process group id with setpgid(0, $$).  When running under an rlogin shell,
I can logout and the daemon process keeps running.  However, if I'm using
the Display Manager, it does it's utmost to kill the process when I logout.

Since the apollo doesn't have a NOHUP signal, I can't kill('NOHUP', $$) it.o

How can I setup a process so that the DM won't kill it upon logging out???

Thanks in advance!
 
Michael T. Hickman                 mth@cci.com
CAE/CAD Systems Administrator      (716)482-5000 x2913
Computer Consoles Inc.     
Rochester, NY            

-- 
               .
          ____ _\        Michael T. Hickman
 ----____/ ___/  )       CAE/CAD Systems Administrator
/ ___ _--- /    /___     Computer Consoles Inc.

rtb@cernapo.cern.ch (Rainer Tobbicke) (04/16/91)

mth@cci632.cci.com (Michael Hickman) writes:


>I have written a program in PERL that forks daemon process.  I have the
>daemon process do a ioctl(TTY, &TIOCNOTTY, 0), and even give it a unique
>process group id with setpgid(0, $$).  When running under an rlogin shell,
>I can logout and the daemon process keeps running.  However, if I'm using
>the Display Manager, it does it's utmost to kill the process when I logout.

Create a server process, either with the 'cps' DM command or with
/etc/server -p my.script.
--
Rainer Toebbicke       
European Organisation for Nuclear Research (CERN)
Geneva, Switzerland
rtb@cernapo.cern.ch, rtb@cernvm.cern.ch

wjw@ebh.eb.ele.tue.nl (Willem Jan Withagen) (04/17/91)

In article <rtb.671799710@cernapo.cern.ch> rtb@cernapo.cern.ch (Rainer Tobbicke) writes:
=>mth@cci632.cci.com (Michael Hickman) writes:
=>
=>
=>>I have written a program in PERL that forks daemon process.  I have the
=>>daemon process do a ioctl(TTY, &TIOCNOTTY, 0), and even give it a unique
=>>process group id with setpgid(0, $$).  When running under an rlogin shell,
=>>I can logout and the daemon process keeps running.  However, if I'm using
=>>the Display Manager, it does it's utmost to kill the process when I logout.

As far as I was able to drag this for my Apollo-support person long time ago.

It seems that when the DM logs a user off, it sends all the processes
owned by the display/user not only the signal SIGHUP but also SIGAPOLLO.
Now the later is not caught by most of the programs (like shells, etc :) )
and hence the burst into tears, and then kill themselves.

Once in a while it helps to do a crp to the same node. It is always effective
to do a rsh on the same node and fork the froces from there. Then it owned
by a ttyp and doesn't get stabbed in the back by a SIGAPOLLO.

Please correct me if I tell it wrong,
	Willem Jan Withagen.

PS: If this is true, then it might be a good one for the questions list
	kept by Jim Rees. You can get it at dabo.citi.umitch.edu
Eindhoven University of Technology   DomainName:  wjw@eb.ele.tue.nl    
Digital Systems Group, Room EH 10.10 
P.O. 513                             Tel: +31-40-473401
5600 MB Eindhoven                    The Netherlands

hooft@prl.philips.nl (Peter van Hooft) (04/18/91)

In <1129@eba.eb.ele.tue.nl> wjw@ebh.eb.ele.tue.nl (Willem Jan Withagen) writes:

>In article <rtb.671799710@cernapo.cern.ch> rtb@cernapo.cern.ch (Rainer Tobbicke) writes:
>=>mth@cci632.cci.com (Michael Hickman) writes:
>=>>I have written a program in PERL that forks daemon process.  I have the

And the daemons are killed when you log out.

>As far as I was able to drag this for my Apollo-support person long time ago.
>It seems that when the DM logs a user off, it sends all the processes
>owned by the display/user not only the signal SIGHUP but also SIGAPOLLO.

Willem Jan suggests to start the daemon from a rsh

>	Willem Jan Withagen.

With sr10.*, you can of course start daemons with 
/etc/server -p your_evil_daemon &


Peter van Hooft    Philips Research Labs, Eindhoven, the Netherlands
Email: hooft@prl.philips.nl SERI: HOOFT:NLWAYA01 Voice: +31 40744327 
X400:  /PN=PJG.VanHooft/O=research/PRMD=philips400/ADMD=400net/C=nl/

dcm@baldur.dell.com (Dave McCracken) (04/19/91)

hooft@prl.philips.nl (Peter van Hooft) writes:

>In <1129@eba.eb.ele.tue.nl> wjw@ebh.eb.ele.tue.nl (Willem Jan Withagen) writes:

>>In article <rtb.671799710@cernapo.cern.ch> rtb@cernapo.cern.ch (Rainer Tobbicke) writes:
>>=>mth@cci632.cci.com (Michael Hickman) writes:
>>=>>I have written a program in PERL that forks daemon process.  I have the

>And the daemons are killed when you log out.

>>As far as I was able to drag this for my Apollo-support person long time ago.
>>It seems that when the DM logs a user off, it sends all the processes
>>owned by the display/user not only the signal SIGHUP but also SIGAPOLLO.

Beginning at SR10.0, you can just signal(SIGHUP, SIG_IGN), or run it as
"nohup daemon".

When the DM is trying to log out, it generates a list of processes it
would like to kill.  The major criterion is any process that does not
have the "server flag" set, which is part of internal process state.
The DM then sends SIGHUP to all processes on the remaining list.  It
goes through the iterative process of generating the list, then signalling,
several times.  If this does not succeed, it then tries again with 
a status that translates to SIGAPOLLO.

In a process that has SIGHUP set to ignore, the signal processing code
in the OS will set the "server flag" for that process before it drops
the signal.  This process will then get ignored by the DM, and 
be allowed to live.

--
Dave McCracken      dcm@dell.dell.com      (512) 343-3720
Dell Computer       9505 Arboretum Blvd    Austin, TX 78759-7299