[GRASS-user] GRASS temp directory...

I'm curious -- where does GRASS write its temporary files, and how would I change this if I wanted to? Thanks!

--j

--
Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Cell: 415-794-5043
AIM: jgrn307, MSN: jgrn307@hotmail.com, Gchat: jgrn307

Jonathan Greenberg wrote:

I'm curious -- where does GRASS write its temporary files, and how would I change this if I wanted to? Thanks!

--j

What OS are you on? It looks to me like it uses <temp>/grass6-<user>-<pid> so on my linux box it's under /tmp/grass6-...

So you can edit to change the $tmp variable
/usr/lib/grass/etc/Init.sh

Or you can use the example you see there to issue some bash commands once Grass is open (not sure if this works) -
GISRC = /path/you/want
export GISRC
Or you might need to specify it as a commandline option on Grass Launch
see man grass

Here's where I got the hint
http://lists.osgeo.org/pipermail/grass-dev/2006-June/024052.html

Alex

Jonathan wrote:

I'm curious -- where does GRASS write its temporary files,

GRASS session variables go into /tmp/grass6-$USER-$PID/gisrc
This is a very small file.

There is a bit in lib/init/init.sh that sets that, but the ability to
change to $TMPDIR istead of /tmp/ has been commented out. (some mutli-user
systems use a per-user tmp directory instead of a common one)

http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/lib/init/init.sh#L187

It is commented out because:
  http://trac.osgeo.org/grass/changeset/16648
  "revert $TMPDIR capability (instead of /tmp) until
   lib/gis/unix_socks.c can be updated to use $TMPDIR too."

ISTR there was some discussion about that on the GRASS-dev mailing list
at the time, check the Feb 2005 archives for more.

---

Module runtime temp files go into $MAPSET/.tmp/$HOSTNAME/
The idea is that the user will always have write permission to the
$MAPSET dir, and /tmp/ is often a rather small partition so in danger
of filling up when processing large datasets. $MAPSET/.tmp/ is flushed
every time you start and exit GRASS.

r.terraflow uses the STREAM_DIR= dir for temp files (default=/var/tmp).
r.terraflow gets special treatment because it can create multi-gigabyte
tmp files depending on the region size and the memory= setting. What the
default for that should be though could be up for debate, but for files
of that size it is nice to have the flexibility of where they go.

and how would I change this if I wanted to?

"manual intervention in the source code"

Hamish

Hamish wrote:

> I'm curious -- where does GRASS write its temporary files,

GRASS session variables go into /tmp/grass6-$USER-$PID/gisrc
This is a very small file.

There is a bit in lib/init/init.sh that sets that, but the ability to
change to $TMPDIR istead of /tmp/ has been commented out. (some mutli-user
systems use a per-user tmp directory instead of a common one)

http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/lib/init/init.sh#L187

It is commented out because:
  http://trac.osgeo.org/grass/changeset/16648
  "revert $TMPDIR capability (instead of /tmp) until
   lib/gis/unix_socks.c can be updated to use $TMPDIR too."

Note that lib/gis/unix_socks.c doesn't exist in 7.x; there was no need
for it once the monitors were eliminated.

ISTR there was some discussion about that on the GRASS-dev mailing list
at the time, check the Feb 2005 archives for more.

The problem with using $TMPDIR for sockets is that there is a limit on
the length of a pathname for a Unix-domain socket (108 bytes on
Linux). This can cause problems if TMPDIR is under $HOME and $HOME
itself is long (which is quite common with AFS).

--
Glynn Clements <glynn@gclements.plus.com>