Hi guys,
I created the following script to logout users from a
unix system. Please take a look and let me know if
the syntax is correct.
#!/usr/bin/perl
#
#Purpose: To logout users off the system during after
hours.
#
sub DEBUG () { 1 }; # set level of debugness.
open (STDERR, "/tmp/userlog.log") or die $!;
select STDERR;
`who > /tmp/userin`
open (USERS, "/tmp/usersin") or die "can't open
$entry: $!\n";
while (<USERS>) {
my ($user) = (split())[0];
unless ($user = root or ipl) {
print "user root and ipl will not be logged out";
$PIDS =`ps -xa | grep $user | grep -v grep | cut -b
-6`
`kill $PIDS`;
`kill -9 $PIDS`;
}
close USERS;
close STDERR;
thanks,
=====
Peter Lemus
UNIX/NT Networks Engineer
[EMAIL PROTECTED]
--This world is too big for us to be alone.
--A wise man will be master of his mind a fool will be its slave.
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/