LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /etc/cron.daily/tmpwatch script (http://www.linuxquestions.org/questions/linux-newbie-8/etc-cron-daily-tmpwatch-script-861561/)

Soji Antony 02-09-2011 03:03 AM

/etc/cron.daily/tmpwatch script
 
Can anybody help me to understand the following tmpwatch script...

Code:

flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 240 /tmp
/usr/sbin/tmpwatch "$flags" 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 720 "$d"
fi
done

While googling for tmpwatch I found that by default this script will be executed daily and will remove tmp files older than 10 days ... But i can see two <hour> options 240 ( 10 days) & 720 (30 days) in this script... So where can I edit/change so that default ( 10 days ) can be changed to something else ??

Also what does "-x" option do ?

smoker 02-09-2011 11:51 PM

Why don't you change 240 for something else ?

-x is an entry to be excluded from the clean up operation.
man tmpwatch

Soji Antony 02-10-2011 03:55 AM

Thanks a lot ...

Cybertron13 04-14-2011 02:17 AM

for d in /tmp/aaa /tmp/bkk /tmp/bbb /tmp/ccc; do
if [ -d "$d" ]; then
/usr/bin/tmpwatch -f 720 "$d"
fi
done



would this remove the folders aaa bbb and ccc or their content?

Soji Antony 04-15-2011 06:05 AM

Hi

It will remove directory contents, not the directory.


All times are GMT -5. The time now is 07:58 PM.