[ncl-talk] running NCL on a cron invokes wrong NCL version

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Wed Jul 22 17:51:23 MDT 2020


What is probably happening is that cron is skipping your normal shell
startup script such as .cshrc or .bashrc.  This is normal cron behavior.
If your normal startup script sets $PATH or an alias affecting NCL, and is
skipped, then your cron job may find an older version in a system default
path such as /usr/bin.

At the start of your cron job, add an environment command like "setenv
PATH", or possibly invoke your normal startup script, to get your expected
NCL environment.  This is also probably the right place to set NCARG_ROOT,
to reduce hard coded dependencies in your application code.

Here is an article with more details.  See the first paragraph under "Notes
and warnings" near the bottom.

https://drupal.star.bnl.gov/STAR/blog/jeromel/2013/apr/05/how-setup-crontabs


On Wed, Jul 22, 2020 at 4:21 PM Diana Stovern - NOAA Affiliate via ncl-talk
<ncl-talk at mailman.ucar.edu> wrote:

> Hello all,
>
> Has anyone ever had issues running NCL on a cron via a python script?  For
> example, I wrote a python script that calls a bunch of NCL scripts using
> the os.system command (i.e., os.system('ncl ' + regrid_script.ncl).  I
> define the NCARG_ROOT environment in the python script like the help forums
> on this topic suggest with the following code:
>
> os.environ["NCARG_ROOT"]='/usr/local/ncl-6.6.2'
>
> Running the python script from the terminal always invokes NCL 6.6.2.
> However, the NCL version that is invoked from the cron is a really old
> version (6.3.0).  I recently had 6.6.2 installed so I could take advantage
> of the ESMF regridding routines.
>
> My question is, does anyone know why the cron invokes the old version of
> NCL and not the new version specified in the python script?  This is really
> causing problems because the python script tries to run the NCL scripts
> with version 6.3.0, but looking in directories associated with 6.6.2, thus
> errors arise and the script crashes.
>
> Has anyone experienced this issue before and have a quick fix?  How do I
> get the cron to invoke 6.6.2 instead of 6.3.0?
>
> Any advice is greatly appreciated!
>
> - Diana Stovern
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200722/5c30cc62/attachment.html>


More information about the ncl-talk mailing list