Re: Logging users out

[ Available lists | Index of freebsd-hackers | Month of Oct 2000 | Week of 30 Oct 2000 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
<andrew@ugh.net.au>
Date
30 Oct 2000 02:53:32
Subject
Re: Logging users out
Message-ID
Pine.BSF.4.21.0010302019270.7801-100000@starbug.ugh.net.au

In reply to

[ Hide this part ]
 

On Mon, 30 Oct 2000, Ryan Thompson wrote:

> > (b) use tcgetpgrp to get the process group id of the foreground process
> > group on that tty, then with that info use libkvm to find the session
> > leader's pid and send it a SIGHUP
>
> Why not just kill their controlling shell?

I believe that what I'm doing...the "controlling shell" would be the
session leader. The question is how to get its PID.

> Recall that "background" and "foreground" are shell concepts, not
> properties of any given process.

No they are properties of process groups. Each session can have one
foreground process group and multiple background session groups. The
foreground process group is the one that receives signals and input from
the session's controlling terminal.

> a) Kill the controlling shell. This will leave some processes behind that

The question is how to get its PID?

> b) kill -<signal> `ps -axo user,pid | grep user | awk '{print $2}'`

I only want to grab those on the one tty but thats an easy enough
modification.

> c) /sbin/halt is pretty much guaranteed to do the trick ;-)

but sadly rather intrusive on other ttys :-)

Thanks for your help,

Andrew



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Elapsed time: 0.189 seconds