1 |
root |
1.1 |
#!/bin/sh |
2 |
|
|
|
3 |
|
|
# this is my /tmp cleaning script that runs every hour or so... |
4 |
|
|
|
5 |
|
|
cd /tmp || exit 1 |
6 |
|
|
|
7 |
|
|
{ |
8 |
|
|
find . -mindepth 2 \ |
9 |
|
|
\( -type f -o -type l \) \ |
10 |
|
|
\( \ |
11 |
|
|
\( -name "*~" -amin +180 \) \ |
12 |
|
|
-o \( -mtime +14 -atime +14 \) \ |
13 |
|
|
\) \ |
14 |
|
|
\! \( -path .X11-unix -o -path .IROHA -o -path .ki2-unix \) \ |
15 |
|
|
-print0 | xargs -0r rm -f |
16 |
|
|
|
17 |
|
|
find . -mindepth 1 -maxdepth 1 \ |
18 |
|
|
\( -type f -o -type l \) \ |
19 |
|
|
-mtime +1 -atime +1 \ |
20 |
|
|
\! -name ".X*-lock" \ |
21 |
|
|
-print0 | xargs -0r rm -f |
22 |
|
|
|
23 |
|
|
find . -mindepth 1 -depth -type d -print0 | xargs -0r rmdir --ignore-fail-on-non-empty |
24 |
|
|
} >/dev/null 2>&1 |