1825667 Members
4131 Online
109686 Solutions
New Discussion

User dead process

 
SOLVED
Go to solution
peterchu
Super Advisor

User dead process

In our system , each user can only access 1 session , they can't concurrent login to the system for 2 sessions , sometimes , the user process will be dead due to the unexpected reason , then the user can't login again until the dead process was killed by administator , could suggest what is the best way to fix it so that user can login even there is a dead user process ? thx
4 REPLIES 4
KapilRaj
Honored Contributor
Solution

Re: User dead process

Write a script to kill such dead processes which is not attached to a terminal and schedule it thru cron for evey 10 minutes !

Regds,

Kaps
Nothing is impossible
V.Tamilvanan
Honored Contributor

Re: User dead process

Hi,
Add a line on login script to check and kill any dead process of that particular user.

Sample:-

kill -9 `ps -ef|grep $LOGNAME|grep -v grep| defunc|awk '{print $2}'`

Paula J Frazer-Campbell
Honored Contributor

Re: User dead process

Hi

only use a kill -9 as a last resort as it does not allow cleanup.

as well as the above options investigate and find out what is happening to cause this problem, and then of course fix it.

Paula
If you can spell SysAdmin then you is one - anon
Pete Randall
Outstanding Contributor

Re: User dead process

I would suggest that you add to the existing logic that limits them to one session. Presumably, you have code in /etc/profile or in the users .profile to check to see if they have existing sessions. I would add something like this:
PROCESSES=`UNIX95= ps -U $USERNAME | grep -v PID |awk '{ print $1 }' | sort
-n`
for PROC in $PROCESSES
do
echo "\tKilling process $PROC"
kill $PROC
done

This way, if they do have existing processes, they will automatically terminate the previous ones and allow them to log in.


Pete

Pete