and if you kill all users...remember the nologin or they will just log right back in.
If the /etc/nologin file exists, the system prevents the user from
logging in and displays the contents of the /etc/nologin file. The
system does allow the root user to log in if this file exists. The
/etc/nologin file is removed when you reboot the system.
You could also use finger to get a list of users. This is a (non-AIX, but it should work) script I use to kill off Oracle users and their processes after two hours inactivity, if more than 40 users are logged in. I run it every hour 8:00 am - 5:00 pm:
USERS=`finger | wc -l`
if [ $USERS -gt 40 ]
then
rm users 2>/dev/null
finger -i > times
grep hours times > times1
cat times1 | tr -s ' ' ' ' | cut -f1 -d' ' > times2
for i in `cat times2`
do
ps -ef |grep $i | grep -v root| tr -s ' ' ' ' | cut -f4 -d' ' >> users
done
cat users | while read number
do
kill $number 2>/dev/null
done
else
exit
fi
None too elegant, but effective nonetheless. Hope this helps or gives some idea how to proceed in your circumstance.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.