LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   killing a hung up process with a script (https://www.linuxquestions.org/questions/linux-general-1/killing-a-hung-up-process-with-a-script-59575/)

lockejr 05-13-2003 10:52 AM

killing a hung up process with a script
 
Ok here is my situation, In our shipping warehouse I have a print server running CUPS. Every once in awhile ghostscript get hung up and it puts a halt to everything until we can kill gs and restart cupsd. My boss wants me to make a script that will check everyfew minutes to see if gs is hung up or not and if so kill it and restart cupsd. now I know how to kill it without using a pid through my script from searching the forums but how can i get it to check how long, let's say i want it to kill it if it has been running for more than 3 minutes. any ideas?

lockejr 05-13-2003 01:07 PM

nevermind i figured it out

ender42 04-13-2006 11:40 PM

care to share your solution?
 
I'd love to see it...

I assume it started out as something similiar to this:

ps aux|grep user|grep pattern|awk '{print $2}'|xargs kill -9


All times are GMT -5. The time now is 06:35 PM.