Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I restart an application if it's taking a lot of say CPU utilization or taking too much RAM on Linux, is there any shell script to do the same?

share|improve this question
add comment

1 Answer

Why would you want to use a script to do that? Close the application. Or, in the system monitor, end or kill the process. If you don't want to use the GUI, then you can open a terminal, run ps ax to find the process ID and use kill prosessid to end it. Use the -9 switch to use force, but avoid that whenever possible.

share|improve this answer
    
dont want it to be manual, need some automated stuff. –  Varun Sep 29 '11 at 6:38
    
I don't think anything like that exists. For CPU, you can renice it so that all other applications will be prioritized. For RAM.. What if you decide to record a screencast. Should the system just prevent you from doing that? Or if you want to start 3D animations? Having the system automatically deny you the opportunity to do what you want, seems like a bad idea. –  Jo-Erlend Schinstad Sep 29 '11 at 8:27
    
@Jo-Erend Schinstad - actually need this for a server that has multiple applications running on it, and it happends quite many times that one of the many application start taking full utilisation and has to be restarted ... –  Varun Oct 7 '11 at 5:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.