[GRASSLIST:8364] Re: Remote execution of grass53 commands

Thomas Adams Thomas.Adams at noaa.gov
Tue Sep 20 14:50:23 EDT 2005


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.
>
>  
>


-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:	thomas.adams at noaa.gov

VOICE:	937-383-0528
FAX:	937-383-0033




More information about the grass-user mailing list