Detecting stuck process

Chris redhat-list at dotcomdesigners.com
Thu Apr 22 00:42:21 UTC 2004


How can I test, in a bash script, to see whether there is a
process running for say more than 30 seconds, and if so then
execute appropriate action?

I currently have a cron job that runs every X minutes that
runs a script (which restarts the stuck process), but
technically I only need to run this script if a certain
process gets stuck.  How can I pull the info from 'top' and
see if it's more than 30 seconds in the TIME column, and
only then run the rest of my script?

Thanks,

Chris





More information about the redhat-list mailing list