[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: email notification when a process ends?



Spiro Harvey:
>> while ps -ef | grep $processname; do sleep 60; done && echo "done" | \
>> mail -s "subject" user
>> But it might be tricky to identify the right process.
> 
> grepping ps will invariably also return the grep line, so this will
> hit a false positive. Better to use pgrep rather than ps & grep.

Theoretically, you are right. Practically:

$ ps -ef | grep awesome
jrschulz  4051  3866  0 19:47 ?        00:00:28 awesome

To be on the safe side, one can alter the search pattern like this:

$ ps -ef | grep [a]wesome
jrschulz  4051  3866  0 19:47 ?        00:00:29 awesome

J.
-- 
I hate myself but have no clear idea why.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>

Attachment: signature.asc
Description: Digital signature


Reply to: