tmpwatch help
hi
I'm using a VPS with CentOS release 5.10 (Final)
When I SSH with vi /etc/cron.daily/tmpwatch it shows :
===
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 \
-X '/tmp/hsperfdata_*' 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
~
~
===
What I want is /tmp folder to be auto cleared every 24hrs automatically. Would really appreciate if anyone can tell me the exact changes I need to make to this above script
Thanks
John
-
Hi John, I think is better that you use the tmpwatch command directly, I never edited that file manually but I see that there are some variables $flags and $d so if you edit that cron manually you will get in trouble probably I am using Centos 6.x but tmpwatch should be exactly the same that in 5.x root@tulkas [/home/securwp]# tmpwatch tmpwatch 2.9.16 - (C) 1997-2009 Red Hat, Inc. All rights reserved. This program may be freely redistributed under the terms of the GNU General Public License version 2. tmpwatch [-u|-m|-c] [-MUadfqtvx] [--verbose] [--force] [--all] [--nodirs] [--nosymlinks] [--test] [--quiet] [--atime|--mtime|--ctime] [--dirmtime] [--exclude ] [--exclude-user ] root@tulkas [/home/securwp]#
The following code will remove all files from /tmp if they are not accessed in the latest 24 hourstmpwatch --mtime --all 336 /tmp
-Gabriel0 -
[quote="ITGabs, post: 1591152">Hi John, I think is better that you use the tmpwatch command directly, I never edited that file manually but I see that there are some variables $flags and $d so if you edit that cron manually you will get in trouble probably I am using Centos 6.x but tmpwatch should be exactly the same that in 5.x root@tulkas [/home/securwp]# tmpwatch tmpwatch 2.9.16 - (C) 1997-2009 Red Hat, Inc. All rights reserved. This program may be freely redistributed under the terms of the GNU General Public License version 2. tmpwatch [-u|-m|-c] [-MUadfqtvx] [--verbose] [--force] [--all] [--nodirs] [--nosymlinks] [--test] [--quiet] [--atime|--mtime|--ctime] [--dirmtime] [--exclude ] [--exclude-user ] root@tulkas [/home/securwp]#
The following code will remove all files from /tmp if they are not accessed in the latest 24 hourstmpwatch --mtime --all 336 /tmp
-Gabriel
Thank you for the comment Gabriel, but it seems like the files are different and I'm not quite sure what is the meaning of the timing involved here. From the code I pasted do you know where it defines a timeframe? for example after 24hrs these files will be removed?0 -
Hello :) The following post should be of help to you: Tmpwatch Every 24 Hours Thank you. 0 -
Hello Michael, Thank you very much for this guide. I have edited /var/spool/cron/root will post the result within 24-48hrs Thanks 0 -
Works great. Now my tmp folders are clean. Thanks Michael :) 0 -
[quote="johnchristy, post: 1593262">Works great. Now my tmp folders are clean. Thanks Michael :)
I am happy to see the issue is now resolved. Thank you for updating us with the outcome.0
Please sign in to leave a comment.
Comments
6 comments