issue who, want to kill past dates user?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers issue who, want to kill past dates user?
# 1  
Old 10-13-2002
issue who, want to kill past dates user?

root pts/5 Sep 04 11:33 (:0.0)

hi, from the above, how do i remove it?
yls177
# 2  
Old 10-14-2002
What are you asking here?

Is this user still showing as logged in via a "who" command and you want to kill that login session?

If so, try:

#who -uH

You should see the PID of that login session. Kill it. It may need a signal 9 kill to get rid of it. Make sure that this login session has been idle and is not in use. The idle time will by shown in the above "who" command.
# 3  
Old 10-14-2002
will this kill -9 -l restart the system?
yls177
# 4  
Old 10-14-2002
No.

Just to prevent annoying a legitimate user, ensure you have isolated the correct PID, and verified that the corresponding login session is indeed idle, and no longer in use.

I have never known a system to restart by killing the PID of any login session.

BTW kill -9 [PID] should be sufficient.
# 5  
Old 10-14-2002
I am sending a script that kill users with IDLE more than 30 min.
Code:
#!/bin/ksh
# ====================================
# Function   :  Kill Inactive Users
# Author      :  Witt
# Date         :  01/07/16
# ====================================
#
# begin
#
#----------------------------------------------
# Variable declaration
#----------------------------------------------
cmd=w

cmd1() {
awk 'substr($0,34,1) >= 3 { print $0 }'
}

#----------------------------------------------
# Format output
#----------------------------------------------
echo "The following users are inactive more than 30 min..... :"
echo " "
#${cmd} | head -2 | tail -1
${cmd} | cmd1
tot=`${cmd} | cmd1 | grep pts\/ | wc -l`
echo " "
echo "Total of Users with idle more than 30 Min. : ${tot}"
echo ""

#----------------------------------------------
# Kill users with idle more than 30 min
#----------------------------------------------
for i in `${cmd} | cmd1 | grep pts\/ | awk '{print $2}'`
do
fuser /dev/$i > /tmp/$$killusers 2>/dev/null
    for proc in `cat /tmp/$$killusers`
    do
    kill -15 $proc
    done
done
rm -f /tmp/$$killusers
#
# end

I hope help you

Witt

added code tags for readability --oombera

Last edited by oombera; 02-18-2004 at 06:56 PM..
witt
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

User idle time and kill

Hello.. I have many sleepy users on my Solaris box and need to kill them if they are idle for more than 45 minutes for example...I know who -u gives and the idle time but unable to make a awk line to get the condition perfect. Please help...:wall: (9 Replies)
Discussion started by: wimaxpole
9 Replies

2. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

3. Shell Programming and Scripting

Want to find the stdout for the partiuclar user login for past 12 hrs.

Want to find the stdout for the partiuclar user login for past 12 hrs. Say for eg : user login id is teladm And the host name is sys22prod I want to see the stdout for that user id in that host for past 12 hrs (1 Reply)
Discussion started by: mail2sant
1 Replies

4. Shell Programming and Scripting

kill all user processes

Hi there, i've been searching all over and i thought i had understood the way i should go to kill all the processes related to a user. But i'm getting more confused then i was. By lunch time i have to make a database backup, and for that all the users shoul logout. The problem is that many users... (4 Replies)
Discussion started by: vascobrito
4 Replies

5. UNIX for Dummies Questions & Answers

how to kill all the netscape process of a particular user?

how to kill all the "netsacpe" processes of a particular user? (1 Reply)
Discussion started by: karthi_g
1 Replies

6. UNIX for Dummies Questions & Answers

what happens when user does kill 1

what happens when user does kill 1 and kill 0 does the system shutdown (6 Replies)
Discussion started by: santosh149
6 Replies

7. Solaris

kill user session

how do i kill a user session (10 Replies)
Discussion started by: fsmadi
10 Replies

8. AIX

Script allows user to kill other users: I'd like to know HOW...

Hello list, Have a problem that's highlighting gaps in my knowledge; can you assist? We have a script that's tacked onto our trading application which allows branch managers etc. to kill off the sessions of other users at their branch. A menu option in the application spawns a shell running... (8 Replies)
Discussion started by: alexop
8 Replies

9. UNIX for Dummies Questions & Answers

Kill user

I have the below script to kill the user who idle for 180 minutes, it work fine , if I want to have one more checking - if the process is in "Runing" mode not in "Sleep" mode ( ps -aux |grep pid ) , then the process will not be killed ( that mean only kill the "Sleep" mode process ) could suggest... (3 Replies)
Discussion started by: ust
3 Replies

10. UNIX for Dummies Questions & Answers

display went awkwards after issue kill pid

hi, i kill a process which is topas. then i do a fg of the process itself and got this Signal 15 received.finally, the display went as belows.... root@myhost:/]ksh: ^L^L^Lps: not found. root@myhost:/] PID TTY TIME CMD ... (4 Replies)
Discussion started by: yls177
4 Replies
Login or Register to Ask a Question