How to Install tmpwatch CentoOS/Fedora/RHCE :
By default, this package not being installed in Linux (VPS) so that we can install using yum command,
…
Running Transaction
Installing : tmpwatch-2.9.16-4.el6.x86_64 1/1
Verifying : tmpwatch-2.9.16-4.el6.x86_64 1/1
Installed:
tmpwatch.x86_64 0:2.9.16-4.el6
…
tmpwatch Installed Location,
tmpwatch: /usr/bin/tmpwatch /usr/sbin/tmpwatch /usr/share/man/man8/tmpwatch.8.gz
How to cleanup /tmp directory files that haven’t been accessed for at least 30 days,
all the files that haven’t been accessed for at least 30 days,
removing file /root/download/tmpwatch_1
removing file /root/download/tmpwatch_2
removing file /root/download/tmpwatch_3
removing file /root/download/tmpwatch_4
Removing all the files that haven’t been accessed for at least 30 days,
Removing all the files that haven’t been accessed for at least 8 hours,
Remove all the files except directories even if they are empty.
First command is do not delete but listing out what would be deleted and the second command is delete all the files only that haven’t been accessed for at least 30 hours,
# tmpwatch -am 30 –nodirs /tmp
Schedule Cron Job every 5 Hours
1
2
|
0 * /5 * * * /usr/bin/tmpwatch -am 30 --nodirs /tmp |
-d (or) –nodirs Do not attempt to remove directories, even if they are empty.
-m (or) –mtime Deleting files based on modification time
-a,(or) –all Remove all file types
-t (or) –test Don’t remove files, displaying what would be deleted
Recent Comments