Hi

On Mon, Jan 27, 2014 at 06:43:20PM +0100, Pol Hallen wrote:
> Hi all,
> 
> I need add to my script a notify if a process take more than X time,
> so using ps I can see what time take a process:
> 
> ps -ao cmd,etime|grep backup
> /bin/sh ./backup    03:44:55
> 
> what's the easy way to do a notify by email?
> 
> redirect output of ps to file and use sed for analize the past time,
> next verify with if/then or there's a better way?
> 
> any idea?

Hm.. I don't know how to do the notify bit, but you *can* send a
signal to the offending process if it takes more than a certain time -
the command you need for this is "timeout" (part of GNU coreutils).
This is handy for killing off processes that get "stuck"...

Hope this helps
-- 
Karl E. Jorgensen


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20140127183000.GA27891@hawking

Reply via email to