[Gllug] Crons and mail

william pink will.pink at gmail.com
Wed Mar 4 17:46:23 UTC 2009


Thanks for all the great replies, I believe Ruby outputs the same so your
method would work Marcus I shall give it a shot anyhow!

Many thanks,
Will

On Wed, Mar 4, 2009 at 5:26 PM, Marcus Taylor <marcus at fatbeehive.com> wrote:

> On Wed, March 4, 2009 15:40, Richard Jones wrote:
> > On Wed, Mar 04, 2009 at 03:24:16PM +0000, william pink wrote:
> >
>  What I really want to do is send out a email
> >> if theres a error, there is a bash script that runs a Ruby rake task so
> >> I presume there is a
> >> way of manipulating the output of that or perhaps log to a file that can
> >> be tailed+grepped for any obvious error keywords (which doesn't sound
> >> like a great solution).
> >
> > I was fairly sure that MAILTO doesn't send mail if the job is silent.
> > So the solution would be to make the job only print stuff on error :-)
>
> I assume you are looking for errors from the Ruby rake script?
>
> I would edit the bash script to check for the errors from the Rake script
> [either by parsing the output of checking the status of the exit variable]
> - you can them just pass these on or create your own errors messages.
>
> I would then echo these errors messages [if any] to stderr [ echo "$blah"
> >&2 ] in the bash script.
>
> Then in the cron line redirect stdout to >/dev/null and leave stderr alone.
>
> This may not be possible with Ruby/rake scripts - TBH I have no idea what
> a rake script/task consists of.
>
> Cheers
> Marcus
>
> --
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20090304/135ec9e9/attachment.html>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list