summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2009-06-02 07:35:51 +0000
committerbrian <brian@FreeBSD.org>2009-06-02 07:35:51 +0000
commitb741ad3e96345042455577273b4346af99e4296a (patch)
tree8e08aaa6baffdeb8129f44420e4cdac6985fcbab /etc
parent7bd92180e74fab8260b697c4de1f4bfe36a17a4a (diff)
downloadFreeBSD-src-b741ad3e96345042455577273b4346af99e4296a.zip
FreeBSD-src-b741ad3e96345042455577273b4346af99e4296a.tar.gz
Rather than using both -prune (which requires directory-first tree traversal)
and -delete (which implies depth-first traversal), avoid using -delete in favour of -execdir. This has a side-effect of not removing directories that contain files, even if we delete all of those files, but IMHO that's a better option than specifying all possible local filesystem types in this script. PR: 122811 MFC after: 3 weeks
Diffstat (limited to 'etc')
-rwxr-xr-xetc/periodic/daily/100.clean-disks8
1 files changed, 4 insertions, 4 deletions
diff --git a/etc/periodic/daily/100.clean-disks b/etc/periodic/daily/100.clean-disks
index 5884664..b4ebf30 100755
--- a/etc/periodic/daily/100.clean-disks
+++ b/etc/periodic/daily/100.clean-disks
@@ -29,7 +29,7 @@ case "$daily_clean_disks_enable" in
echo ""
echo "Cleaning disks:"
set -f noglob
- args="$args -name "`echo "$daily_clean_disks_files" |
+ args="-name "`echo "$daily_clean_disks_files" |
sed -e 's/^[ ]*//' \
-e 's/[ ]*$//' \
-e 's/[ ][ ]*/ -o -name /g'`
@@ -41,9 +41,9 @@ case "$daily_clean_disks_enable" in
print=;;
esac
- rc=$(find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
- \( $args \) -atime +$daily_clean_disks_days -delete $print |
- tee /dev/stderr | wc -l)
+ rc=$(find / \( ! -fstype local -o -fstype rdonly \) -prune -o \
+ \( $args \) -atime +$daily_clean_disks_days \
+ -execdir rm -df {} \; $print | tee /dev/stderr | wc -l)
[ -z "$print" ] && rc=0
[ $rc -gt 1 ] && rc=1
set -f glob
OpenPOWER on IntegriCloud