Re: NCL from Cronjob

From: Micah David Sklut (micahs AT udel.edu)
Date: Wed Aug 24 2005 - 20:49:36 MDT

  • Next message: Rick Grubin: "Re: NCL from Cronjob"

    Hi Jan,

    I"m am also running ncl from cron and I ran into a similar situation.
    What is happening is that crontab does not use your environmental vars, so
    you need to set the NCARG_ROOT value somewhere before you call NCL.

    There is likely several ways to do this. I am accomplishing this by
    creating a c shell script and setting NCARG_ROOT in the beginning of the
    file and then calling NCL below.
    So this is an example of a cshell file:
    #!/bin/csh

    set path = (/usr/local/bin $path)
    setenv NCARG_ROOT /usr/local

    ncl your_ncl_file.ncl

    Then set the shell file (whatever.csh) script to run in your crontab.

    Micah Sklut micahs@udel.edu
    Geography Department - University of Delaware

    On Wed, 24 Aug 2005, Jan Dutton wrote:

    >
    > Hello,
    >
    > I have a perl script that calls an NCL script via the perl function system()
    > that does not seem to be working quite right.
    >
    > I'm running NCL 4.2.0.a030 on Red Hat 8.
    >
    > When I run the perl script from the command line everything works great, but
    > when I set up a cron job to run the script, the resulting error message is:
    >
    > warning:Unable to Get System Resource File Name?
    > warning:Unable to load System Resource File (null)
    > fatal:GetSysAppDir:Unable to get a default value for the system App Resource
    > directory
    > warning:["Resources.c":721]:Unable to set appSysDir to default value - Using
    > NULL
    > fatal:GetSysAppDir:Unable to get a default value for the system App Resource
    > directory
    > warning:["Resources.c":721]:Unable to set appSysDir to default value - Using
    > NULL
    > warning:Unable to Get System Resource File Name?
    > warning:WorkstationClassInitialize:Unable to access rgb color database -
    > named colors unsupported:[errno=2]:No such file or
    > directory
    > warning:["Palette.c":1525]:NhlLoadColormapFiles: Invalid directory
    > encountered in colormap path specification
    >
    >
    > The simplest possible perl script looks something like:
    >
    > #! /usr/bin/perl
    >
    > system("/home/me/script.ncl")
    >
    > My ncl script uses:
    >
    > load "/usr/local/ncarg/lib/ncarg/nclex/gsun/gsn_code.ncl"
    > load "/usr/local/ncarg/lib/ncarg/nclex/gsun/gsn_csm.ncl"
    >
    > rather than the "load "$NCARG_ROOT/lib/ . . . " references.
    >
    >
    > So, when run from cron with
    >
    > * * * * * /home/me/perlscript.pl
    >
    > the process generates the above message.
    >
    >
    > Any suggestions,
    >
    > Thanks,
    >
    > Jan
    >
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >
    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Thu Aug 25 2005 - 10:02:40 MDT