Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

kill process

ust3
Regular Advisor

kill process

I have a script ( run by user ) that can find some user dead process ( like below ) , then another script will kill all these process, however , I found that one of these process is the user self login process ( pid : 58741 ) , therefore , when the script try to kill these dead process , it may be kill the user login process , if it is the case , then the user will logout and DO NOT kill other process ( of course , the user is logged out , all user's command will be stopped ) , can advise if I want to make sure it can kill ALL process , what can I do ? thx



58741 <-- the user login process
82587
58412
47521
87934
25462


6 REPLIES
Dennis Handly
Acclaimed Contributor

Re: kill process

Do you want it to kill the "user login process"? Or skip that and kill the rest.

If the former, you may need to use nohup to prevent the killing process from dying.
If the latter, you need to filter out that specific process.
Kapil Jha
Honored Contributor

Re: kill process

Hi,
Can you post the script , how u r finding that these are the dead process????
if u are doin some grep...
why u using two scripts???
ps -ef|grep <>|awk ....|xargs kill

may help!!!1
More infomation is needed.
BR,
Kapil
I am in this small bowl, I wane see the real world......
Venkatesh BL
Honored Contributor

Re: kill process

The problem is a little confusing. If the script that is supposed to report 'dead' processes reports an 'active' user login process, then something needs to be corrected in the script itself.
ust3
Regular Advisor

Re: kill process

thx replies,

I would like to clearly state what I want , I use the script in linux , in linux , there is a path /proc , that have all user process (as below) , I have a script to kill this process by user themself , but when the user kill its process , it may be kill its current process before kill other process , then the user have logged out but other process is still in the system , so can advise how to force the user can kill all process at the same time ? thx

cd /proc
ll |grep test_user
dr-xr-xr-x 3 test_user EDP 0 Nov 27 17:20 10437
dr-xr-xr-x 3 test_user EDP 0 Nov 27 17:20 10587
Dennis Handly
Acclaimed Contributor

Re: kill process

>I use the script in linux

Since this is linux specific, you should have created a thread in that forum.

>it may be kill its current process before kill other process but other process is still in the system, so can advise how to force the user can kill all process at the same time?

As I mentioned the first time, use nohup:
$ nohup your_script > /dev/null 2>&1 &
(If you don't redirect the output, it will be placed in nohup.out.)
Stuart Browne
Honored Contributor

Re: kill process

Don't use '/proc' like that. There are better ways.

If you are that user, the 'ps -u'.

If you aren't that user, then 'ps -U ' instead.
One long-haired git at your service...