Hi, I am using Ubutu 10.04. I have some apps that create a few temporary files in /tmp/<file>
as part of their shutdown process. I want to inspect those files when the apps are closed in the event of a system shutdown. However, when the system comes up again I find that all temporary files have been deleted. How can I ask the system not to clear the files in /tmp/
on shutdown?
-
/tmp
is often an in memory file system so once you reboot, it's gone.Instead of trying to preserve
/tmp
, I would try to get my processes to write to a different directory. If they are written well, the apps should honor the TMPDIR environment variable to decide where to write temp files; you can then have it point to another directory such as/var/tmp
which should survive a reboot. -
you could change the times that files in /tmp have to be modified in order to delete them. but if you configure your linux distro to keep the files /tmp for ever and/or a long time then you hard disk will be filled with useless (or not) files in /tmp directory .. take a look here
EricJLN : Taking into account the comment about /tmp being mounted as a "ramdisk" (aka tmpfs), use the `mount` command to make sure your system wasn't configured that way. -
You can define when files from
/tmp
can be deleted. You should change the value ofTMPTIME
variable form/etc/default/rcS
file.The default value of these variable is
0
- these means that files will be deleted every time computer starts. Set upTMPTIME
to3
means that will delete files older than 3 days.But you can set
TMPTIME=infinite
- these means that the files will be never deleted.From Lukasz Stelmach
0 comments:
Post a Comment