[comp.sys.apollo] How do you create a persistent background process from DM?

talent@spanky.sps.mot.com (09/12/90)

I need to start a background process from a display manager window that
will continue running after logout.  I've tried nohup, nice, and &.
The process is started from a /bin/csh script running in a DM window.

The problem is that any process started from a DM window will be stopped
at logout.

I can create a process that keeps running after logout by using cps.
cps creates a server process that is owned by "user".  This is unacceptable
because the process I am running must access several files.  In order to
make these files available to the server process they must be made
accessable by "user" and, therefore, they are made accessable to anyone
else who cares to create their own server process.

Am I missing something or is there no simple way to do this?


Steve Talent, Motorola Semiconductor Products Sector CAD
Tempe, AZ  602-897-5440,  talent@dover.sps.mot.com

wjw@eba.eb.ele.tue.nl (Willem Jan Withagen) (09/12/90)

In article <2411@dover.sps.mot.com> talent@spanky.sps.mot.com () writes:
>I need to start a background process from a display manager window that
>will continue running after logout.  I've tried nohup, nice, and &.
>The process is started from a /bin/csh script running in a DM window.
>
>The problem is that any process started from a DM window will be stopped
>at logout.
>

My guess is that you're still running OS SR 9.7?
If that's the case, this is your problem:
	When the DM halts is sends a signal to all processes at 'owns'.
	the signal send is SIGAPOLLO, which is something different from
	SIGHUP. Now most processes don't like the Apollo signal and kill
	themselves.
The solution:
	I always used for this is to remote loging into the same node 
	with rsh and start the program then. Now when you exit, get the
	program the SIGHUP and that is caught by either nohup or others.
	Then exit the remote shell, now the process becomes parent-less.
	Upon exit of the DM does it not send a signal to the newly
	created process, since it does not have a parent. (So certainly
	not the DM.)

This feature took use several weeks to find out what was going on.

Succes, and let us know it it worked,

		Willem Jan Withagen

Eindhoven University of Technology   DomainName:  wjw@eb.ele.tue.nl    
Digital Systems Group, Room EH 10.10 BITNET: ELEBWJ@HEITUE5.BITNET
P.O. 513                             Tel: +31-40-473401
5600 MB Eindhoven                    The Netherlands

rees@pisa.ifs.umich.edu (Jim Rees) (09/13/90)

In article <2411@dover.sps.mot.com>, talent@spanky.sps.mot.com writes:
  I need to start a background process from a display manager window that
  will continue running after logout.  I've tried nohup, nice, and &.
  The process is started from a /bin/csh script running in a DM window.

This has worked at various times in the past but seems to be broken again
now.

I have a program I use instead of the 'nohup' builtin.  It contains the
following code:

	setpgrp(0, getpid());

	signal(SIGHUP, SIG_IGN);
	ioctl(0, TIOCNOTTY, 0);

	maxfds = getdtablesize();
	for (i = 0; i < maxfds; i++)
		close(i);

This works fine on sr10.2.

rabbe@infolog.se (Rabbe Fogelholm) (09/13/90)

In article <2411@dover.sps.mot.com> talent@spanky.sps.mot.com (Steve
Talent, Motorola Semiconductor Products Sector CAD) writes:

>I need to start a background process from a display manager window that
>will continue running after logout.  I've tried nohup, nice, and &.
>The process is started from a /bin/csh script running in a DM window.
>
>The problem is that any process started from a DM window will be stopped
>at logout.
>
>(... text deleted ...) Am I missing something or is there no simple
way to do this?

I would suggest something like the following (tested on a node that
runs SR9.7, has /sys/spm/spm running, and BSD4.2 installed):

    /com/crp -on $NODEID -me -cpo '/bsd4.2/usr/bin/sleep 567'

The example starts a process that just sleeps for a while. It can be
inspected using 'ps x'. The technique should work for SysV too, but I
can't test that case.
-- 
________________________________________________________________________
Rabbe Fogelholm, Infologics AB     rabbe@infolog.se    fax: +46 8 960846