Running Shell Script for grib2ctl /gribmap on crontab

zilore mumba zmumba at YAHOO.COM
Thu Nov 13 02:08:08 EST 2008


Sincere apologies as my question is not purely Grads. I have a shell script (code below) which:
1. concatenates files via the cat command;
2. runs grib2ctl to create a ctl
3. run gribmap
When I run the script manually (i.e. on the command line) it performs as required.
When I run it through crontab, it concatenates files ok, but it creates a ctl file which is empty and it does not create an idx file (even though I have indicated the paths to where grib2ctl and gribmap are located)
Assistance will be appreciated.
Zilore.
 
#
#!/bin/bash
#This script processes UKMO model data from RETIM-SYNERGIE and archives it on 
#the ACMAD system. The cycles (or times) are 00 and 12.
#
ctl_ext=".ctl"
grib_ext=".grib"
UK_sufx="2"
dash="-"
model="ukmo"
#
model_dat=`date "+%Y%m%d"`
model_hr=`date "+%H"`
#
model_dat1=$( date -d "1 day" "+%Y%m%d" )
#
model_mon=`date "+%m"`
mon_name=`date "+%B"`
yr=`date "+%y"`
#
if [ $model_hr -gt "15" ]
  then
    cycle="12"
else
    cycle="00"
fi
#
base_dir="/home/Mumba/archive/$model_mon$dash$mon_name$yr"
#
      cd $base_dir/$model/$model_dat
#      pwd
      cat *H > $model$cycle$grib_ext
      /usr/local/bin/grib2ctl.pl -verf $model$cycle$grib_ext > $model$cycle$ctl_ext
      /usr/local/grads/bin/gribmap -i $model$cycle$ctl_ext -v -e
      rm *H
  #
      mv $base_dir/$model/$model_dat1/*H $base_dir/$model/$model_dat
      cat *H > $model$cycle$UK_suf$grib_ext
      /usr/local/bin/grib2ctl.pl -verf $model$cycle$UK_sufx$grib_ext > $model$cycle$UK_sufx$ctl_ext
      /usr/local/grads/bin/gribmap -i  $model$cycle$UK_sufx$ctl_ext -v -e
      rm *H
   #
#
date
exit 0



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20081112/f0b79c13/attachment.html 


More information about the gradsusr mailing list