[GRASS-dev] File based GRASS batch processing?

Markus Neteler neteler at itc.it
Mon Jan 22 18:13:16 EST 2007


On Tue, Jan 23, 2007 at 12:10:20AM +0100, Markus Neteler wrote:
> Attached a first sort of working hack "diff". Could be
> certainly nicer.

Sorry, this one I wanted to send.

Markus
-------------- next part --------------
Index: init.sh
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/init/init.sh,v
retrieving revision 1.99
diff -u -r1.99 init.sh
--- init.sh	8 Jan 2007 15:22:24 -0000	1.99
+++ init.sh	22 Jan 2007 23:12:00 -0000
@@ -90,6 +90,7 @@
             echo "  GRASS_WISH                     set wish shell name to override 'wish'"
             echo "  GRASS_HTML_BROWSER             set html web browser for help pages"
             echo "  GRASS_ADDON_PATH               set additional path(s) to local GRASS modules"
+            echo "  GRASS_BATCH_JOB                shell script to be processed as batch job"
 	    exit
 	    ;;
 	
@@ -665,6 +666,16 @@
     exit 1
 fi
 
+# hack to process batch jobs:
+if [ -x "$GRASS_BATCH_JOB" ] ; then
+   if [ ! -f "$GRASS_BATCH_JOB" ] ; then
+      echo "Batch job file $GRASS_BATCH_JOB as defined in GRASS_BATCH_JOB variable not found. Exiting."
+      exit 1
+   else
+      SHELL="$GRASS_BATCH_JOB"
+   fi
+fi
+
 # Start the chosen GUI but ignore text
 case "$GRASS_GUI" in
     
@@ -866,3 +877,8 @@
 echo 
 echo "Goodbye from GRASS GIS"
 echo
+if [ -x "$GRASS_BATCH_JOB" ] ; then
+   echo "Batch job $GRASS_BATCH_JOB was executed."
+   exit 0
+fi
+


More information about the grass-dev mailing list