[K12OSN] cron to kill users or group?

Petre Scheie petre at maltzen.net
Mon Mar 27 14:45:35 UTC 2006



Robert Arkiletian wrote:
> On 3/24/06, Petre Scheie <petre at maltzen.net> wrote:
>> I've been considering something like this:
>>
>> for x in `cat file-of-IDs-to-be-logged-off`
>> do
>> pkill -u $x
>> done
> 
> 
> How about something like this
> 
> for x in `last | grep 'still logged in' | awk '{print $1}' | sort | uniq`
> do
> pkill -u $x
> done
> 
That would certainly work, but in my case there are some users, power users if you will, 
that I don't want to kick off.  A bunch of the IDs on my system are shared, almost 
kiosk-like, and those are the ones I want to reset.  Plus, I like the idea of killing 
only those IDs I explicity specify, to avoid any unforeseen consequences.  If I had 
hundreds of these IDs that needed to be pkilled, I might feel different; but even then, 
I think I'd just spend a bit of time refining the list of those IDs and stick with the 
'kill only those I say' approach.




More information about the K12OSN mailing list