Question

Bill Vermillion fp at wjv.com
Sat Jan 15 14:55:52 PST 2005


On or about Sat, Jan 15 10:30 , while attempting a Zarathustra 
emulation Brian K. White thus spake: 

> 
> ----- Original Message ----- 
> From: "Bill Vermillion" <fp at wjv.com>
> To: "filePro List" <filepro-list at lists.celestial.com>
> Sent: Saturday, January 15, 2005 12:55 AM
> Subject: Re: Question

[Lucretia Deletia hacks away a lot of text here .. wjv]

Brian said:

> >>Even though one of my own most useful gadgets relies on them,
> >>but only for 2 minutes each and it doesn't matter if they go
> >>away or if fake ones show up or if permissions get fudged or
> >>if the box powers off ungracefully etc... It's a self-cleaning
> >>temp directory based on writing a timestamp file every minute
> >>and deleting files older than the 2-minutes-ago timestamp file.
> >>Worst case is after a reboot some files might live another 2
> >>minutes longer than they should have.

To which I asked:

> >What do you do to keep the temp files that are supposed to be there
> >until the ap using them exits?

> It is not "/tmp" but a seperate dir which happens to be "/ptmp"
> which is also linked to ".../htdocs/ptmp"

Make sense.

> Most uses of temp files are done in /tmp or PFTEMP rather than
> this /ptmp.

> Mostly it is used for times when I want to throw something
> into the users browser but I don't want to give the world
> access to the place it came from by linking it in htdocs. So I
> generate a unique, meaningless name and copy it into ptmp and
> send a winstart command with the necessary url. The LAST thing
> I want to have to do in a case like that is try and guess how
> long to sit and wait before deleting the temp file, with the
> application frozen all that time or a cgi script hanging around
> or an fp process tying up a licence.

> So I don't. I create the temp file, fire off the command to
> view it, and move right on and never think of the file again
> after that. I don't care if the users net connection allows
> the file to zip in instantly or if it takes almost the whole 2
> minutes. If 2 minutes ever isn't long enough I can twiddle one
> variable in the script and make the lifetime whatever it needs
> to be. I originally used 4 min, toyed with the idea of letting
> things live a whole day.

Now I see. But if the application is using a temporary file and
keeps it open, you could use the standard procecure that creates
the file and then deletes. As long as the application has the
temporary file open it is still in the system - and is still
taking up disk space though it is not seen in the directory - and
then when the app closes the last link to the files is gone, and
the space is reclaimed.

That's one of the things that it is not intuitive in Unix and
is often overlooked or a person forgets about it if you don't use
it. 

I've seen this used in instances where the temporary file is not be
to seen by others but it is needed by the ap.

...

> 2 minutes is a pretty short lifetime for that kind of stuff
> though, it'd be better if it hung around for a day, but it's
> not worth making another magic dir just for that.

And as I wrote above, if the ap hangs onto it, then removing it
early is no problem.

Thanks for explaining what you are doing.

Bill
-- 
Bill Vermillion - bv @ wjv . com


More information about the Filepro-list mailing list