Operating System - HP-UX
1830024 Members
18138 Online
109998 Solutions
New Discussion

User process in the system

 
SOLVED
Go to solution
peterchu
Super Advisor

User process in the system

Sorry to I am not familiar with script writing ,

attach is the /etc/profile in my system , we have limit each user can only have one login in the system . When the user login , if the system found the user have a dead process in the system , the system will confirm the user to kill the previous login and try to kill it ( this is the additational function of the profile ) , but I have a problem now , the system can't kill the previous dead process now , I think it is because the system only try to kill the PID , but not the PPID ,so it will pop the "not the process owner" when trying to kill the process , could suggest how can I change the script so that it will kill the PPID ? or is there any reason why the dead can't be killed ? thx in advance.
6 REPLIES 6
Eric Antunes
Honored Contributor

Re: User process in the system

Hi,

Why you don't try to kill just the user processes?

"ps -fu " will give the processes the user is running. Use "kill " to kill only those processes...

Best Regards,

Eric Antunes

Each and every day is a good day to learn.
peterchu
Super Advisor

Re: User process in the system

thx reply ,

i tried ps -fu , but it only find the PID of the grep process (eg. 6795 in the below example) , it seems not find the PPID , could suggest how to kill the PPID ? thx again.


root 6795 0.0 0.0 1712 580 pts/19 S 14:34 0:00 grep Bohmer
Michael Schulte zur Sur
Honored Contributor
Solution

Re: User process in the system

Hi,

your grep also finds your grep. Use
grep -v grep before you grep for your user.
ps -ef | grep -v grep | grep $atty | ...

greetings,

Michael
peterchu
Super Advisor

Re: User process in the system

thx reply ,

I have changed the script (ps -ef | grep -v grep | grep $atty | ) but it still can't kill the process , it seems still can't kill the PPID , could suggest what can I do ? thanks again.
Eric Antunes
Honored Contributor

Re: User process in the system

Hi,

Did you tried "kill -9 PID" (not PPID)? To use "kill -9", you have to be sure those processes are really not doing anything, since they are just killed...

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
peterchu
Super Advisor

Re: User process in the system

thx reply ,

yes, kill -9 can kill the process , but I am not prefer let the uesr use the -9 as there are some strange problems .

Except this method , can suggest what can I do ? thx.