Conditionally Changing Subject Line of Email Sent by Cron Job

CLIFFORD ILKAY clifford_ilkay-biY6FKoJMRdBDgjK7y7TUQ at public.gmane.org
Mon Aug 9 19:37:12 UTC 2010


On 08/09/2010 03:02 PM, William Park wrote:
> Since return code can only be tested after it returns, you have to do
> this in 2-steps.  Try something like,
>
>      */17 * * * * /home/cilkay/virtualenvs/test/bin/update_feeds.sh>/tmp/x 2>&1; if test $? -eq 0; then SUBJECT="SUCESS"; else SUBJECT="FAILURE"; fi; mail -s "$SUBJECT" cron_results-BYqcrMrCQOc at public.gmane.org<  /tmp/x
>
> First command runs, second command tests for its return code, and
> finally third command sends the mail.

Thank you. That did it.
-- 
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6

<http://dinamis.com>
+1 416-410-3326
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list