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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CRON JOB TO KILL USERS AT SPECIFIC TIME 2

Status
Not open for further replies.

teletubby5e

Technical User
Oct 31, 2002
147
US
I am looking for a script to dump off all users at a certain time via cron, without harming any system processes, one of which runs under a user name called TIMER. I found a nice one on the following link, but am not sure how to edit it to tell it to exclude the username TIMER and any system processes. Seems like using a who -u would be better for that.


Is there a way that you can 'test run' a script in AIX to certify its stability? I am just not comfortable enough with my script editing yet, to run this in a production environment.

Thanks, Jeff
 
Perhaps try using finger with a grep -v for TIMER, then kill the resulting user list. You can test this principal by replacing whatever kill command you're using with an echo to screen or file just to confirm it's doing what you want.
 
$ ps -ef | grep pts/ | grep -vE "grep| ps -ef "
maestro 25418 36136 0 16:10:34 pts/2 0:00 /usr/bin/ksh
maestro 26566 25418 0 16:10:44 pts/2 0:00 telnet mptwst
ts39461 28682 29008 0 14:21:46 pts/0 0:00 /usr/bin/ksh
$ ps -ef | grep pts/ | grep -vE "grep| ps -ef " | awk '{ print $2}' | xargs -l echo " kill "
kill 24506
kill 25418
kill 26566
kill 28682
kill 35976
$
 
Many thanks to both of you ! My life is much easier now. This has enabled me to stabilize my nightly backup. Thanks again! Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top