Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to setup cron job to kill user's?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a big problem getting my user's to logout. I would like to setup a cron job to auto kill all user's at a set time. Does anyone know how to make this happen?

Thanks
Jason
jgilbreath69@hotmail.com
 
Try script del_user:
=======================

#!/bin/ksh
for USER in `who -i|awk '{ print $7 }'`
do
kil $USER
done
========================
than add the above script to crontab at the required time ,say 5:00 :

crontab -e

0 5 * * * del_user
"Long live king Moshiach !"
h
 
Or I refer you to the timeout question previously in the list.

Use the TMOUT variable to set up say an hour of idle activity logs out the user :

In /etc/profile :

Comment in TMOUT change the value to =3600 i.e. 60 * 60 = 3600 seconds = one hour, export the variable..log out and back in et voila.

The choice is yours, either a script in the cron or using the above mechanism.

Best of luck

PSD
IBM Certified Specialist - AIX V4.3 Systems Support
IBM Certified Specialist - AIX V4 HACMP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top