[GRASSLIST:8375] Re: Remote execution of grass53 commands
Suprit Kumar
suprit at darya.nio.org
Thu Sep 22 02:16:05 EDT 2005
Thanks Glynn and Tom!
I appreciate your timely help and suggestions and hope will be able to write
better scripts following them .
Also I was able to run commands(script) in Grass5.3 non-interactively on a
remote machine using the following as suggested by Glynn.
ssh <remote-machine> sh -c '"SHELL=/path/to/script
grass53 /home/suprit/grass53/GISDBASE/LOCATION/MAPSET"'
With regards,
Suprit
On Wednesday 21 September 2005 00:20, Thomas Adams wrote:
> Suprit,
>
> Also, the book "Open Source GIS: A GRASS GIS Approach" has excellent
> examples of GRASS shell scripting.
>
> Tom
>
> Glynn Clements wrote:
> >Suprit Kumar wrote:
> >>The problem starts when I tried to remotely execute the commands from a
> >>script using ssh.
> >>
> >>Here is example of the script and output,
> >>
> >>-------------------------------------------------------
> >>#!/bin/bash
> >>
> >>#First I have to start a grass session on remote machine "chambal"
> >>ssh chambal grass53 /home/suprit/grass53/GrassData/globe/goa
> >># Then next grass command as.
> >>g.region raster=goa_map_1 (# I tried "ssh chambal g.region
> >> raster=goa_map_1" too.)....
> >>...........
> >>--------------------------------------------------------
> >>This gives out output as shown below, the shell prompt is not returned
> >> and the next command (g.region raster=goa_map_1) does not get executed
> >> at all..... When I kill the Grass session by ctr-c only then g.region
> >> gets executed giving obvious error "ERROR: GISBASE not set"
> >>
> >>---output---
> >>Cleaning up temporary files.....$TERM
> >>Starting GRASS ...
> >>
> >>>tput: No value for $TERM and no -T specified (both -T i specified and
> >>
> >>$TERM=xterm here
> >>
> >>Welcome to GRASS 5.3.0 (15 May 2004)....
> >>This version running thru the Bash Shell (/bin/bash)
> >>Help is available with the command: g.manual
> >>See the licence terms with: g.version -c
> >>Start the graphical user interface with: tcltkgrass&
> >>When ready to quit enter: exit
> >>
> >>
> >>
> >>Am I doing something horribly wrong or there is some settings to be
> >> changed? Any suggestions and help is welcome.
> >
> >The grass53 script starts an interactive shell; it doesn't complete
> >until you exit the shell.
> >
> >If you want to run a script within a GRASS session, try:
> >
> >ssh chambal sh -c '"SHELL=/path/to/script grass53
> > /home/suprit/grass53/GrassData/globe/goa"'
> >
> >Alternatively, your script will need to set up the necessary variables
> >(e.g. GISBASE, GISRC) itself before attempting to run GRASS commands.
> >
> >For more information, read the grass53 script itself, as well as the
> >Init.sh script which it calls.
--
--
Suprit Kumar
JRF,
National Institute of Oceanography,
Dona Paula-403 004, Goa, INDIA.
email:suprit at nio.org
Tel. : +91-(0)832-2450-400
Fax. : +91-(0)832-2229102
--
More information about the grass-user
mailing list