[GRASS-dev] File based GRASS batch processing?
Hamish
hamish_nospam at yahoo.com
Thu Jan 25 00:46:48 EST 2007
suggested improvements attached:
+ force text mode (don't launch gis.m).
(probably it should exit with error if MAPSET is not given on command line
& GRASS_BATCH_JOB is defined, too. so avoid "$ETC/set_data". Or create new
GRASS_GUI value "none", set if BATCH is used?)
+ replace final "exit 0" with "exit $EXIT_VAL" so the whole grass-batch
command exits with the return value of the batch script, not hardcoded
value "0".
bug:
- your hack fails in Cygwin due to init.sh "if [ "$CYGWIN" ] ; then
... export SHELL=" hack earlier in the script
simplify $GRASS_BATCH_JOB to $GRASS_BATCH?
JOB implies ^Z, fg, bg, PID, ...
Hamish
-------------- next part --------------
Index: lib/init/init.sh
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/init/init.sh,v
retrieving revision 1.102
diff -u -r1.102 init.sh
--- lib/init/init.sh 25 Jan 2007 05:03:34 -0000 1.102
+++ lib/init/init.sh 25 Jan 2007 05:25:04 -0000
@@ -693,6 +693,7 @@
exit 1
else
echo "Executing '$GRASS_BATCH_JOB' ..."
+ GRASS_GUI="text"
SHELL="$GRASS_BATCH_JOB"
fi
fi
@@ -864,6 +865,7 @@
rm -rf "$LOCATION/.tmp"/* # remove gis.m session files from .tmp
else
"$ETC/run" "$SHELL"
+ EXIT_VAL=$?
fi
;;
esac
@@ -905,6 +907,6 @@
echo
if [ -x "$GRASS_BATCH_JOB" ] ; then
echo "Batch job '$GRASS_BATCH_JOB' (defined in GRASS_BATCH_JOB variable) was executed."
- exit 0
+ exit $EXIT_VAL
fi
More information about the grass-dev
mailing list