tmpwatch example

Tmpwatch is linux tool to automate temporary file cleanup. When you need examples for your inspiration try this example:

Delete older files than 48 hours:
tmpwatch -m 48 /var/www/cache/

Delete older files haven’t been accessed 30 days:
tmpwatch  30d /var/www/cache/

NoDelete older files haven’t been accessed 30 days – only test with show list files to delete:
tmpwatch  –test 30d /var/www/cache/

 

Example of crontab line:
01 00 * * * root tmpwatch -m 10 /var/www/cache/

any switches of tmpwatch:

-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

SHARE IT:

Leave a Reply