[GRASS5] Re: [GRASSLIST:4564] Re: .tmp files

Markus Neteler neteler at itc.it
Tue Sep 24 10:02:37 EDT 2002


On Tue, Sep 24, 2002 at 03:53:30PM +0200, Roger Bivand wrote:
> On Tue, 24 Sep 2002, Markus Neteler wrote:
> 
> > (moving this to the developers list)
> > 
> > On Tue, Sep 24, 2002 at 03:01:45AM +0100, Glynn Clements wrote:
> > > 
> > > Gordon Keith wrote:
> > > 
> > > > > The ".tmp" directory should get cleaned whenever you exit a GRASS
> > > > > session.
> > > > >
> > > > > If your ".tmp" directories are accumulating files, that suggests that
> > > > > GRASS sessions are being terminated abnormally, e.g. by killing the
> > > > > xterm. Always terminate the session by typing "exit" in the shell.
> > > > 
> > > > OK.
> > > > 
> > > > It's probably my fault then.
> > > > 
> > > > I've been using g.gisenv set= to swap better mapsets and locations a lot 
> > > > rather than having to exit and restart grass several times a day. I 
> > > > guess this is one of the gotchas of doing that.
> > > 
> > > OK; yes, the other reason why temporary files may accumulate is if you
> > > have long-running sessions. Until recently this seldom happened, as
> > > you had to quit in order to change the location or mapset.
> > 
> > Well, this happens regularly (at least for our group).
> > We work in one location only, so there is no obvious reason
> > to leave the location. Then the .tmp/ stuff accumulates quickly.
> > 
> > One problem is that some GRASS modules open temp files with
> > G_tempfile() but do not remove them on exit.
> > We were talking about that also in May:
> > 
> > http://grass.itc.it/pipermail/grass5/2002-May/002978.html
> > 
> > > Either terminate the session at the end of the day, or manually run
> > > $GISBASE/etc/clean_temp occasionally. Unfortunately, this can't be
> > > automated, as a few programs expect temporary files to survive for a
> > > while after the program which created them has terminated.
> > >
> > > Mostly this is due to either:
> > > 
> > > a) a program creating a temporary file, then running some other
> > > program with that temporary file as input.
> > > 
> > > b) d.text, which saves its input in a temporary file; this file needs
> > > to remain until the monitor is erased, as it will be used if the
> > > monitor needs to be redrawn (either via d.resize/d.redraw or, for
> > > XDRIVER, if the monitor is resized via the window manager).
> > > 
> > > Apart from that, I suspect that a lot of programs need to take more
> > > care to remove temporary files once they are no longer needed.
> > 
> > Yes.
> > 
> > Another suggestion may be a GRASS daemon which get's informed about
> > temp files and can delete them later (rather than the  simplistic 
> > clean_temp approach). We should probably centralize such management
> > functionality.
> > 
> > Roger, does your GRASS daemon have such capabilities (or potential to
> > be extended?).
> > 
> No daemon around yet ...

sorry, I was thinking of Roger Miller's daemon.

> What about a cron job - FAQ entry to suggest to people to have cron clear 
> up their temp files. Do we know which ones need to be protected from 
> removal - this is also info a daemon might need?

exactly. We need a tool to distinguish between temp-in-use and oldish
temp files. That's why they may be registered at the daemon. The daemon
can watch processes running and check if they terminated/got killed.

Only the d.text problem cannot be solved like that (or the temp file
registrations needs extended information not to delete certain temp
files).

Markus




More information about the grass-dev mailing list