Using the unix "at" command with GRASS

At times it would be nice to be able to make a file containing a set of
GRASS commands, then submit it to be executed at a particular time using
the unix "at" command or "crontab" Although I can make a file of commands
turn it into an executable (chmod 0777 filename) and then run the file
of commands by typing filename, this doesn't work if filename is submitted
to the "at" command, as follows:

  at 10:30 filename

When the job runs at 10:30, I get a mail message saying my "at" job
produced the following message "TERM: Undefined variable." GRASS is
running when I submit the "at" job, but the operating system doesn't
seem to recognize that the command file is a GRASS job. Any ideas how
to use "at" or "crontab" to line up a set of grass jobs to be run at
certain times?

  Bill Baker
  bakerwl@uwyo.edu

BAKERWL@UWYO.EDU (BAKERWL@UWYO.EDU) writes on 02 Oct 94:

At times it would be nice to be able to make a file containing a set of
GRASS commands, then submit it to be executed at a particular time using
the unix "at" command or "crontab" Although I can make a file of commands

ditto. A while back, I hacked the grass shell (grass4.1 and GIS.sh)
so that using as something like:
  grass4.1 [-ef] [-d database] [-l location] [-m mapset]

I don't recall exact usage. the -f flag means "fast" (don't go
through annoying init screens). the -e flag means "fast exit" (don't
go through the usual exit-dance). the other options override defaults
in .grassrc.

Perhaps this could be extended a bit, e.g.,:
  grass4.1 -c 'g.list rast'
(-c like /bin/sh, would imply -fe above).

Someone well versed in Bourne shell could probably do this pretty quickly.
It would make a nice enhancment for future versions (hint hint).

at 10:30 filename

When the job runs at 10:30, I get a mail message saying my "at" job
produced the following message "TERM: Undefined variable." GRASS is
running when I submit the "at" job, but the operating system doesn't

hmm... what command? I just tried a quick test and didn't have
any problem:

Mapset <mccauley> in Location <spearfish>
GRASS 4.1 > at 1431
at> g.list rast
at> <EOT>
warning: commands will be executed using /usr/unsup/bin/tcsh
job 781126260.a at Sun Oct 2 14:31:00 1994

Mapset <mccauley> in Location <spearfish>
GRASS 4.1 > mailx
mailx version 5.0 Mon Sep 27 07:25:51 PDT 1993 Type ? for help.
"/var/mail/mccauley": 1 message 1 new
>N 1 James Darrell McCa Sun Oct 2 14:31 27/1083 Output from "at" job

[...]

Your "at" job "/var/spool/cron/atjobs/781126260.a" produced the following output:

----------------------------------------------
raster files available in mapset PERMANENT:
aspect geology rushmore soils.ph transport.misc
bugsites landuse slope soils.range trn.sites

don't know that it would make a difference, but
did you exit grass before the command was executed.

--Darrell