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

Logoff users from console w/out rebooting server ? 4

Status
Not open for further replies.

protos

IS-IT--Management
Apr 28, 2002
127
US
I have to run the
"who" command to see who is still logged into our db
but need to kick them off
so i can update it, but i have been rebooting it
(shutdown -g0 -y)
in order to do so, because they either leave for the day and are logged in or another location.

What/how can i boot them off from the command line ??

Thanks gang
 
You could kill their shells or application processes.

When you do a who you should see which terminal they are logged in to. ps -ft terminalid will list the processes they are running. To kill their login shell you will need to use kill -9. Annihilannic.
 
yes i believe it lists
several users who are logged in but it shows for example
userA
several times,
1. how do you know which login shell to kill
2. how do you kill for each specific user(will it have different login shell #'s ??

i'm not there now is why i ask otherwise monday i can get more info

thanks so much
 
Yes, but if you follow what I said, each user will be logged in to a different terminal. You can type ps -ft terminalid and it will list the processes that user is running against that terminal. They will have different login shell process IDs. Annihilannic.
 
You may also want to look at the kill option within the fuser command to kill only logins using the database.
 
or whodo Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
Awesome !!
Thanks Gentlmen

Ed, what does the 'whodo'
list ?
 
is
kill -9
all you type or what is the syntax to kill a certain id ??

thanks
 
whodo lists each active terminal session, the user, and each associated process. Kinda wraps w and ps together. The detail section lists the terminal, the process id, idle time, and process name. You would look at the idle time to determine which users simply didn't logout.

On a side note, I wouldn't jump right into a kill -9. Try just 'kill' first, which will send a TERMinate signal instead of a KILL signal. Difference here is the TERM allows the process to do some cleanup work (if it is written properly) before stopping, while a KILL stops it cold. The TERM might not work (maybe 10% of the time?), but when it does, you will have less risk for corruption of your db.

The basic synax for kill is 'kill x { . . .} -options where x is a process id and the 9 would be an option -- there are others, try 'man kill'. You can enter several processes separated by spaces, so you would have something like

kill 1234 1267 1289 -9

to kill processes 1234, 1267 and 1289 with a signal 9 (KILL), although, as I stated, I would try it without the '-9' first.
 
wall "Bye Suckers"|sleep 2|init 1 =-=-=-=-=-=-=-=-=-=-=-=
Unix Systems Engineer
=-=-=-=-=-=-=-=-=-=-=-=
 
mhkwood,

How would you "pause the screen"
to see all users, since i can only see 2 at a time
runing the whodo
command ?

thanks

on a side note, do you know of a good windows X
i can run to view the exact console on a windows pc ?
thanks I totally appreciate your help
 
I see the "who" command gives me the full list in one screen
w/ terminalid

is there a way from here to Term/Kill the terminalid ?
 
whodo | more ?? Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
you can use `idleout` to kill sessions cleanly that are not active.

eg
idleout 2

then
idleout 0
to stop it.
Then you can deal with any users that are active.
It is sometimes not a good idea to sledgehammer users when they are updating a database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top