Script Works, But Not with CRON

Bob Stockler bob at trebor.iglou.com
Tue May 4 19:05:09 PDT 2004


On Tue, May 04, 2004 at 11:19:29AM -0400, Ken Brody wrote:
| Bob Stockler wrote:
| > 
| > The following script works _perfectly_ when excuted from
| > the command line, but fails when run by 'cron'.
[snip]
| > What am I overlooking?
| [...]
| 
| Get rid of the ">/dev/null 2>&1" on each line, and instead wrap the
| entire command set with:
| 
|     (
|     ... current script ...
|     ) >/tmp/output.dat 2>&1
| 
| You can then examine the output file for any error messages.  (Just
| remember that the output file will not be all text, but rather text
| intermixed with terminal escape codes.)

I (sorta) took your advice, and had 'cron' run this script:

  #!/bin/sh
  TERM=ansi ; PFTERM=ansi ; PFPROG=/u/appl ; PFDATA=/u ; PFDIR=""
  REPORT=$PFPROG/fp/dreport
  DXMAINT=$PFPROG/fp/dxmaint ; DDIR=$PFPROG/fp/ddir
  export TERM PFTERM PFPROG PFDATA PFDIR REPORT DDIR DXMAINT
  {
    for fPfile in invtry invitm
    do $DDIR $fPfile -L # >/dev/null 2>&1
       $DXMAINT $fPfile -ra -e # >/dev/null 2>&1
    done
    $REPORT invtry -f zip -y '' -z last12 -a -u # >/dev/null 2>&1
    $REPORT invitm -f zip -y '' -z '' -v last12 -id -a -u # >/dev/null 2>&1
  } 1>/tmp/script.out 2>/tmp/script.err
  exit 0

The file "script.out" was just the filePro screen display.

But, surprise of surprises, "script.err" held:

  *** A System Error Has Occurred ***
  /pcfiles2/filepro/invtry/keyx1: Permission denied

  Standard Input Redirected

  *** A filePro Error Has Occurred ***

  Standard Input Redirected

  *** A System Error Has Occurred ***
  /pcfiles2/filepro/invtry/keyx1: Permission denied

  Standard Input Redirected

  *** A filePro Error Has Occurred ***

  On File: /pcfiles2/filepro/invitm

  File not found

  Standard Input Redirected

I don't know where it got "/pcfiles2" (that's a directory
in the root filesystem where Windows users store their PC
files) for $PFDATA$PFDIR or where "keyx1" came from.

Back to the drawing board tomorrow.

Bob

-- 
Bob Stockler - bob at trebor.iglou.com
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).


More information about the Filepro-list mailing list