[comp.unix.questions] Is this a logout ?

ezra@daimi.aau.dk (Thomas Ravnholt) (03/06/91)

Hello !

 In my .logout I move some files around, an delete some
files. When I rlogin on another machine, I do not want
the .logout to remove/delete when I logout from the
rlogin.

 The question: How can I decide if it is a logout from
               the rlogin.


 I have not been able to find the answer in the FAQ-list.

Thanks in advance     ezra@daimi.aau.dk

phil@medici.trl.OZ.AU (Phil Nicholson) (03/08/91)

In article <1991Mar6.120728.10069@daimi.aau.dk>, ezra@daimi.aau.dk
(Thomas Ravnholt) writes:
>  The question: How can I decide if it is a logout from
>                the rlogin.

This works for me.
In your .logout have (with csh)

if(`tty` !~ /dev/tty[pqr]* ) then
#not a pseudo tty, so presumably not an rlogin or telnet etc.
	commands...
endif

Roll your own if you use a different shell.

Alternatively, you could awk your way through the output of ps to find out
if the parent of the current process is in.rlogind.
But this approach varies from one unix to another.


Phillip Nicholson                   AI Systems  Telecom Australia Research Labs
                                           email  : p.nicholson@trl.oz.au
                                           phone  : +61 3 541 6245 
                                           fax    : +61 3 543 8863