Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:tmpwatch [2015/10/15 22:43] billdozor created |
linux_wiki:tmpwatch [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 8: | Line 8: | ||
**Checklist** | **Checklist** | ||
- | * Distro: Enterprise Linux 6 | + | * Distro(s): Enterprise Linux 6 |
---- | ---- | ||
Line 22: | Line 22: | ||
===== cron.daily ===== | ===== cron.daily ===== | ||
- | After installation, | + | After installation, |
- | /etc/cron.daily/ | + | See examples below for contents and explanation. |
- | <code bash> | + | |
- | #! /bin/sh | + | |
- | flags=-umc | + | |
- | / | + | |
- | -x / | + | |
- | -X '/ | + | |
- | / | + | |
- | for d in / | + | |
- | if [ -d " | + | |
- | / | + | |
- | fi | + | |
- | done | + | |
- | </ | + | |
---- | ---- | ||
Line 69: | Line 56: | ||
* -x => Skip specified path. (if directory, skip all files inside) | * -x => Skip specified path. (if directory, skip all files inside) | ||
* -X => Skip paths matching specified pattern. | * -X => Skip paths matching specified pattern. | ||
+ | |||
+ | ---- | ||
===== Examples ===== | ===== Examples ===== | ||
- | Section 2, sub-content. | + | ==== Fictional App in /opt ==== |
+ | |||
+ | * Clean up an application' | ||
+ | * Check access time (-u), modification time (-m), and change time (-c). | ||
+ | * Delete if any of the three are older than 30 days (30d). | ||
+ | <code bash> | ||
+ | tmpwatch -umc 30d / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Default / | ||
+ | |||
+ | **First tmpwatch (with all the " | ||
+ | * Clean up /tmp | ||
+ | * Check access time (-u), modification time (-m), and change time (-c). | ||
+ | * Exclude all directories specified after each " | ||
+ | * Exclude any directory that matches the pattern after the " | ||
+ | * Delete if any of the -umc options are older than 10 days (10d). | ||
+ | |||
+ | **Second tmpwatch " | ||
+ | * Clean up /var/tmp | ||
+ | * Check access time (-u), modification time (-m), and change time (-c). | ||
+ | * Delete if any of the -umc options are older than 30 days (30d). | ||
+ | |||
+ | **Third / | ||
+ | * Clean up each directory ($d) in the for loop pattern. | ||
+ | * Check access time (-u), modification time (-m), and change time (-c). | ||
+ | * Force deletion (-f) | ||
+ | * Delete if any of the -umc options are older than 30 days (30d). | ||
+ | |||
+ | / | ||
+ | <code bash> | ||
+ | #! /bin/sh | ||
+ | flags=-umc | ||
+ | / | ||
+ | -x / | ||
+ | -X '/ | ||
+ | / | ||
+ | for d in / | ||
+ | if [ -d " | ||
+ | / | ||
+ | fi | ||
+ | done | ||
+ | </ | ||
---- | ---- | ||