User profile

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.

Who owns the parent process? If it's root, it may not allow the user to kill off the 'dead' process. Post an example of the process you want to kill off by a certain user and the OS/version you are using.