Skip to main content.
home | support | download

Back to List Archive

Re: Error running swish-e as cron job

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Wed Apr 14 2004 - 18:22:34 GMT
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).


> 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.


> PATH="$PATH:/usr/local/my_swish_install/bin"
> 
> cd /path/to/search1/dir
> swish-e -c search1.conf -S prog

I like to do:

  cd /path/to/search/dir && swish-e -c conf -S prog -v0 || exit

and hope that it doesn't generate any output.  The || exit part is
optional , depending if you want to continue with processing in the
script.

And I do that right in the cron job for simple indexing jobs (without
the || exit part).

You don't have to cd either.

Also, I'd recommend just sourcing some toplevel config file so PATH and
PERL5LIB and things are in one location.  Something like:

#!/bin/sh

# setup environment:
. $HOME/.my_startup.sh

# index web site
swish-e -c $SWISH_CONFIG_DIR/website.conf -S prog -v0 || exit

# index apache
swish-c -c $SWISH_CONFIG_DIR/apache.conf -S prog -v0 || exit


But, my shell skills suck, so I'm sure there's more clever ways to do
this.

-- 
Bill Moseley
moseley@hank.org
Received on Wed Apr 14 11:22:34 2004