--- Bill Moseley <moseley@hank.org> wrote:
>
> On Wed, Apr 14, 2004 at 09:04:13AM -0700, Greg Fenton wrote:
> > #!/bin/bash
> >
> > MAILTO="address_to_email_on_error@mydomain.com"
>
> Does that work? That's not in cron's environment? I think that will
> only work in the crontab (and if your version of cron supports
> MAILTO).
Nope, you are right, that won't work...I cut out a lot of what I
typically do in a shell-script. I tend to use the "mail" command
myself directly instead of relying on cron.
I also tend to capture output to a file if I want it and mail it to
myself or I direct it to /dev/null (unless I truly want to have cron
email it to me...but see the above paragraph).
I just believe that keeping control of everything within my script is
the best way to go...that way I can run the script via other methods
too (no just cron).
> > PERL5LIB="$PERL5LIB:/usr/local/my_swish_install/lib/perl5"
>
> Is there anything in the default swish-e installation that requires
> that? I tried to get rid of the need to set any perl library paths.
Likely not. Again, I just smoked up the example.
> I like to do:
>
> cd /path/to/search/dir && swish-e -c conf -S prog -v0 || exit
To be honest, I actually code the *entire* path to most commands so I'd
have "/usr/local/bin/swish-e -c conf". Or, to be even more accurate, I
create variables for each command and use the variable in my script:
SWISH_CMD=/usr/local/bin/swish-e
cd /path/to/search && $SWISH_CMD -c conf -S prog
Using "|| exit" is completely valid. Typically I'll add an exit code
like "|| exit 1" to let cron know that an error occured. But then
again, see my first paragraph in this response.
>
> But, my shell skills suck, so I'm sure there's more clever ways to do
> this.
>
They seem quite sane to me.
greg_fenton.
=====
Greg Fenton
greg_fenton@yahoo.com
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
Received on Wed Apr 14 12:56:39 2004