LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   getting files deleted on /tmp (https://www.linuxquestions.org/questions/linux-general-1/getting-files-deleted-on-tmp-282774/)

ines 01-27-2005 02:54 AM

getting files deleted on /tmp
 
I need very usually to download files fom internet on /tmp.
I launch the download every night, I see the files being downloaded.
The following day I get the files deleted.
any idea?

ilikejam 01-27-2005 03:18 AM

I don't know what distro you're running, but on RedHat style systems, there's a cron job which deletes files from /tmp which are older than a certain number of hours.

On my system (Fedora C.3) the number of hours is 240, but it could be different on yours. Have a look in /etc/cron.daily for something like tmpwatch, and have a look inside.

If you can't find /etc/cron.daily, then try to find out more about cron on your distro.

Dave

jschiwal 01-27-2005 03:20 AM

Some distro's have an option to delete the files when rebooting, so that the /tmp directory doesn't get to full. Use a directory in your home directory to download files. Another option is to use /var/tmp for the downloading of files. The /tmp partition is really just for the system and tends to be smaller than the /var partition.

I don't know where you would change it. I don't even know which distro you have, but one of the scripts that runs during shutdown, or maybe even a cron script is probably what is doing it.

For mandrake, the graphical setting is in the BOOT setup. You might also browse through the files in /etc/sysconfig/. Sometimes settings are based there.

ines 01-27-2005 03:41 AM

Dave, I looked in /etc/cron.daily and that's its content:

/usr/sbin/tmpwatch 240 /tmp
/usr/sbin/tmpwatch 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch -f 720 $d
fi

which meens that files are deleted after 240 hours. In my case , I started download the files yesterday (~ 16h ) and this morning I got them deleted (very fewer than 240 hours).

jschiwal, this pb occures even if I don't rebbot my system.

ilikejam 01-27-2005 03:53 AM

Hmmm.

1) Is there enough space on /tmp to let the download finish?
2) It's possible (but very unlikely) that the program you're using to download is removing any temp files it's created in /tmp when it exits, and is accidentally removing the downloaded file as well.

Apart from that, I'm not sure.

Dave

ines 01-27-2005 04:06 AM

Yes dave, I hve about 4 GB free on my /tmp and files I need to download do not exceed 1.5GB.
I use the wget tool for downloading my files.
What I have noticed, is that files that have been downloaded and yet used (even by a simple read) are not delated. But files that I left during remote downloading are deleted.
I dont't have enough space disk on my home, that's why I need to download these files on /tmp.
I work on a shared machine and don't have root rights to get more space on my home.

ilikejam 01-27-2005 04:16 AM

The administrator is probably running a cron job to remove files from /tmp on a regular basis.

If files which get read don't get deleted, then try running 'touch /tmp/downloadedfile' after wget finishes, then it will look like the file has been read.

I seem to remember a bug in wget a while ago which did strange things when downloading large files. If you've got an old version of wget, it could be that.

Dave

ines 01-27-2005 04:33 AM

The problem arieses when I'm not in my office (by night when I usually launch my downloads) so the touch command could not really solve mu pb. Perhaps soud I put on a script that executes the wget command and executes the touch command after the download is completed.
I'm using the 1.8.1 wget version.

ilikejam 01-27-2005 04:51 AM

I don't think that bug was in 1.8.1.

You could run:
wget http://www.example.com/thing.gz; touch /tmp/thing.gz

to have the file touched after wget exits.

Dave

ines 01-27-2005 04:58 AM

yes ilikejam, I think it would be a great idea

Thanks alot.

ilikejam 01-27-2005 04:59 AM

Actually, if you want to be really sure, you could do:

wget http://www.example.com/thing.gz; while true; do touch /tmp/thing.gz; sleep 300; done;

That would touch the file every 5 minutes, so it would look like the file is being used.

Dave

ines 01-27-2005 08:22 AM

I understand now why my files disappear.
In fact, while being donloading, files have as date the current date. Once download is finished they acquire the date they got from their original source (the date they have on the site from which they are downloaded). So that, the 240 hours are largely exceeded and files are deleted.

ilikejam 01-27-2005 09:16 AM

Very interesting. I didn't know that happened.

Using 'touch' after downloading should do the trick.
I'll have to remember that.

Cheers.

ines 01-28-2005 03:35 AM

ilikejam,
tank u gain for your help


All times are GMT -5. The time now is 01:26 PM.