cancel
Showing results for 
Search instead for 
Did you mean: 

Kill dead login

 
ust3
Regular Advisor

Kill dead login

we are running Redhat server , sometimes user's login will be disconnected because unable network ( or other unexpected reason ) , then they can't login again ( because we control all user only have ONE login at the same time ) in a short time , they have to wait the system logout the dead connection , can advise how to let the user can logout the previous dead connection rather than waiting the system log them out ? I have read some relevant before , Redhat seems have build-in function to solve it , can advise how to set it ? thx.
4 REPLIES
Steven E. Protter
Exalted Contributor

Re: Kill dead login

Shalom,

First, try setting the parameter TMOUT in the user profile. This will time out idle sessions not in any application.

Second your limit script can provide the user the choice of terminating the old session. User larry for example hung. His session is active. User larry is perfectly empowered to issue a kill on his previous process under all circumstances.

So.

echo "You are already logged in. Do you want to close your previous session?:"
read yesno

If the user answers yes, issue a kill for the process ID the script that limits logins has clearly identified.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
ust3
Regular Advisor

Re: Kill dead login

thx reply ,

"Second your limit script can provide the user the choice of terminating the old session. User larry for example hung. His session is active. User larry is perfectly empowered to issue a kill on his previous process under all circumstances" ,

can advise the script to terminating the old session ?

thx
Steven E. Protter
Exalted Contributor

Re: Kill dead login

ussername=larry
PID=(ps -ef | grep $username awk '{print $2}')
kill $PID

On its simplest level.

Show me the code you use (not the whole script) to determine how many logins a user has.

ps -ef | grep is inferior to:
UNIX95=1
ps -C $username

But the new code takes time to test.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
ust3
Regular Advisor

Re: Kill dead login

thx Steven ,

I hv modified the /etc/profile to check the no. of user login and control the user login , but the coding is not good , so can advise is there any existing function in Redhat or linux system to control the no. of user login ? if yes , is it OK to merge the function with your script ? thx in advance.