We can use find's built-in -delete primary to remove old /tmp files
and directories. This is somewhat less error-prone than execing
rm or rmdir.
- todd
Index: etc/daily
===================================================================
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.93
diff -u -p -u -r1.93 daily
--- etc/daily 9 Sep 2019 20:02:26 -0000 1.93
+++ etc/daily 22 Aug 2020 01:21:16 -0000
@@ -50,17 +50,17 @@ if [ -d /tmp -a ! -L /tmp ]; then
find -x . \
\( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \
-o -path './tmux-*' \) \
- -prune -o -type f -atime +7 -execdir rm -f -- {} \; 2>/dev/null
+ -prune -o -type f -atime +7 -delete 2>/dev/null
find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \
! -path ./.ICE-unix ! -name . \
- -execdir rmdir -- {} \; >/dev/null 2>&1; }
+ -delete >/dev/null 2>&1; }
fi
# Additional junk directory cleanup would go like this:
#if [ -d /scratch -a ! -L /scratch ]; then
# cd /scratch && {
-# find . ! -name . -atime +1 -execdir rm -f -- {} \;
-# find . ! -name . -type d -mtime +1 -execdir rmdir -- {} \; \
+# find . ! -name . -atime +1 -delete
+# find . ! -name . -type d -mtime +1 -delete \
# >/dev/null 2>&1; }
#fi