Hi our server has a weird issue where once a month or so a GS (GhostScript) process gets stuck and eats 10-75% CPU until I kill the process. strace hasn't provided anything useful so until I can resolve this correctly I'd like to create a script that checks every few minutes and kills any GS process that has been running for longer than 5 minutes. Under normal circumstances this process should complete in a few seconds to a minute at most.
In top the command shows up as "GS". How do I go about doing this? I'm assuming I need to write a BASH script as well as set it to run on an interval? The box is a webserver running CentOS 6.5.
Thanks!