cordump.com

TIP: Are we there yet? Having a command notify you when its done

by daven on Jan.19, 2008, under Quick Tips

Sometimes you have a long running process and rather than check up on it periodically you would just rather have it notify you. From the command line this is really simple you can have it email you using the mail command.

% ps auxww ; echo "ps done" | mail -s "ps done" me@example.com

This will just email you “ps done”, now suppose you want the output of the command do

% ps auxww | mail -s "ps done" me@example.com

this will include the the output of the command in the body of the email message

% time ps auxww | mail -s "ps done" me@example.com

and finally include the bash command time before the command you will get the exact amount of time it took to run included at the bottom of the e-mail.
By piping to mail you can get a bit of piece of mind not needing to constantly check on you process and with the right options even get the output and the exact run time.


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...