mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
33 lines
897 B
Bash
Executable File
33 lines
897 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $Id: 110.clean-tmps,v 1.2 1997/09/01 11:07:55 ache Exp $
|
|
#
|
|
# This is a security hole, never use 'find' on a public directory
|
|
# with -exec rm -f as root. This can be exploited to delete any file
|
|
# on the system.
|
|
#
|
|
# Use at your own risk, but for a long-living system, this might come
|
|
# more useful than the boot-time cleaning of /tmp. If /var/tmp and
|
|
# /tmp are symlinked together, only one of the below will actually
|
|
# run.
|
|
#
|
|
|
|
exit 0 # do not run by default
|
|
|
|
if [ -d /tmp ]; then
|
|
cd /tmp && {
|
|
find . -type f -atime +3 -ctime +3 ! -name '.X*-lock' \
|
|
-exec rm -f -- {} \;
|
|
find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
|
|
>/dev/null 2>&1
|
|
}
|
|
fi
|
|
|
|
if [ -d /var/tmp ]; then
|
|
cd /var/tmp && {
|
|
find . ! -name . -atime +7 -ctime +3 -exec rm -f -- {} \;
|
|
find -d . ! -name . ! -name vi.recover -type d -mtime +1 -exec rmdir -- {} \; \
|
|
>/dev/null 2>&1
|
|
}
|
|
fi
|