[ic] Purging session/ and tmp/ - expireall, or rm?

Barry Treahy, Jr. Treahy at MMaz.com
Fri Nov 21 07:49:19 EST 2003


DB wrote:

>> I use a very simple little script I call clean_session_tmp to do it:
>>
>> #!/bin/sh
>>
>> for DIR in $*
>> do
>>         for i in session tmp
>>         do
>>             if test -d $DIR/$i             then
>>                 find $DIR/$i -type f -mmin +480 | xargs 
>> --no-run-if-empty rm
>>                 find $DIR/$i -type d -empty -depth -mindepth 1 | 
>> xargs --no-run-if-empty rmdir
>>             else
>>                 echo "$0: $DIR/$i doesn't exist."
>>             fi
>>         done
>> done
>>
>> The 480 is 8 hours. You can change the number to what you want.
>>
>> It is called in cron:
>>
>> 22 4 * * * /usr/local/interchange/bin/clean_session_tmp 
>> /home/*/catalogs/*
>>
The example 'path' above, since this is in 'user' space, can presume that what you are actually targeting are the files in the session and tmp subdirectories (ie CATROOT/session and CATROOT/tmp) ? 

Barry

-- 

Barry Treahy, Jr                       E-mail: Treahy at MMaz.com
Midwest Microwave                          Phone: 480/314-1320
Vice President & CIO                         FAX: 480/661-7028
                       





More information about the interchange-users mailing list