Does adding

 

export VUFIND_HOME=/path/to/vufind

export VUFIND_LOCAL_DIR=/path/to/vufind/local

 

(substituting appropriate paths, of course)

 

help?

 

If those environment variables aren’t set up, the script may not be able to find all the parts it needs.

 

- Demian

 

From: Shepard, Thomas - 1150 - MITLL [mailto:tshepard@ll.mit.edu]
Sent: Tuesday, August 05, 2014 1:47 PM
To: vufind-tech@lists.sourceforge.net
Subject: [VuFind-Tech] running vufind marc imports from crontab

 

Can someone give me advice on running vufind marc imports in a crontab.

 

I have a shell script that imports a number of .mrc files, each with its own set of properties.

But I can’t seem to make it work as a scheduled crontab command, though the touch commands within the script work okay, confirming that my paths are set correctly.

 

Here is how I call the shell script itself in crontab:

 

15 13 * * * cd /usr/local/vufind2 && ./step_1_clear_index.sh

20 13 * * * cd /usr/local/vufind2 && ./step_2_import_marc.sh

 

(The step_1 script, which simply stops vufind, clears the index, and starts vufind,  works perfectly fine, but the step_2 script only runs the touch part.)

 

 

Here is a sample section from my shell script:

#!/bin/sh

echo "Importing limited Archives records..."

cd /usr/local/vufind2 &&

touch step2_last_started

sh import-marc.sh -p local/import/import_loginrequired-true.properties local/import/librarycat/vufind_all_limited_2.mrc

(I also tried ./import-marc.sh -p local/import/import_loginrequired-true.properties local/import/librarycat/vufind_all_limited_2.mrc and even used full paths for both commands and arguments)

 

I can imagine that many of you are writing similar scripts and running them in crontab. Can you tell me what I am doing wrong? I’ve consulted several programming sites and from one of them got the tip on combining commands in a single crontab line, but most report that the solution is to include full paths or adding a cd command, which is what I did, but what really may be throwing this off are the multiple arguments required for import-marc.sh.

 

BTW, my import and harvesting scripts all work fine at the command line; they just don’t work in a crontab job.

 

Thanks in advance,

Thom

 

Thom Shepard

MIT Lincoln Lab
244 Wood St.

Lexington, MA 01523

tshepard@ll.mit.edu

781 981 0370