Cleaning the /tmp directory

blaise bpicinbono at WORLDONLINE.FR
Mon May 23 10:15:48 EDT 2005


Le lundi 23 Mai 2005 15:50, Greg Taylor a écrit :
> In the Itasca example data set the configuration file stores temporary
> images in /workshop/tmp. Over time the temporary images really pile up
> and suck space. Does anyone have any bash/csh scripts handy that'll
> remove files that were last modified a minute or more again? Or is there
> any easier way of doing this that I'm missing?

from : http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptRH72
there is :

Setup MapServer IMAGEDIR and cleanup script
  $ sudo mkdir /tmp/ms_tmp
  $ sudo chmod 777 /tmp/ms_tmp
... also add the commands above to /etc/rc.d/rc.local as well to recreate the 
directory when the system reboots, after a /tmp cleanup... 
... create a logical link for the ms_tmp directory on the web server 
  $ cd /var/www/html
  $ ln -s /tmp/ms_tmp ms_tmp
 ... create "/etc/cron.daily/ms_clear_tmp.sh" ... you can also place the file 
in /etc/cron.hourly/ for busier sites... 
 #! /bin/sh
 #
 # MapServer temporary file cleanup - run daily by cron
 #
 # Flush all files from /tmp/ms_tmp older than 6 hours (360 minutes)
 #
 find /tmp/ms_tmp -name "*.*" -amin +360 -exec rm -f {} \;
 exit 0

Adapting it to your file tree, this should do the job.



More information about the mapserver-users mailing list