1833568 Members
4434 Online
110061 Solutions
New Discussion

killing old processes

 
Asya
Regular Advisor

killing old processes

Hello,

I work for a software development company and our developers constantly test new software.

The problem that arose is that after their build is done, it leaves bunch of processes running, which eventually kills the system.

Is there any way to find out which processes have been running for 4 days and kill them (they belong to a particular user)?

I've read various posts here and couldn't find anything to help me figure out this problem.

Thank you!
Asya
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: killing old processes

ps -ef | grep

That will provide you all the information you need on the processes.

There are lots of processes on your box that run for more than 4 days, so something that nukes all processed that have run that long will kill the box, same as the old processes.

This sounds like an education issue. Have your developers run the ps command and kill their own processes when they log off.

Alternatively use ps -ef | grep developername to get the process list and kill them that way.

I'm attaching a script called gkill. It kills groups of processes based on pattern matching. It won't touch root processes. Used judiciously, it can help you with this issue. I have a non-interactive version as well, if you like the tool.

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
Biswajit Tripathy
Honored Contributor

Re: killing old processes

Since processes are left running after the testing is
done, this is obviously a problem with the software
being developed. Let your developers know about this.
Steven has already told you how to remove these
processes, but once your product is released, the
customers are not going to like processes being left
over even after the software is done.

- Biswajit
:-)
Gordon  Morrison_1
Regular Advisor

Re: killing old processes

As said before, this is primarily an education issue.

Try this as a teaching method.

put this line in root's crontab:
1 2 * * * su - baduser -c 'kill -9 -1'
(substitute the username of the process owner)
This will kill all processes owned by baduser at 02:01 every morning.
What does this button do?
Asya
Regular Advisor

Re: killing old processes

Thank you for all your responses.
Yes, i know this is an educational matter and developers should know better. But as I said, this is a testing procedure and you guys telling me to tell developers to fix it themselves is not a very good solution.

I've decided to create a tmp file (though cronjob) where every monday server stores PID's of jobs that belong to this particular user. On saturday there is a cronjob that kills all those PID's.

Thank you for all your responses. I'm closing this thread.
Asya
Regular Advisor

Re: killing old processes

closing thread..