/etc/init/mounted-tmp.conf is in mountall 2.54.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # mounted-tmp - Clean /tmp directory
#
# Cleans up the /tmp directory when it does not exist as a temporary
# filesystem.
description "Clean /tmp directory"
start on (mounted MOUNTPOINT=/tmp) or (mounted MOUNTPOINT=/usr)
# The "/tmp" here is just a default and is overridden by the "start on"
# case above. It protects someone from running this job directly and
# having no $MOUNTPOINT defined.
env MOUNTPOINT=/tmp
task
script
if [ x$MOUNTPOINT = x/tmp ] && [ ! -x /usr/bin/find ] ; then
touch /tmp/.delayed_mounted_tmp_clean
exit 0
elif [ x$MOUNTPOINT = x/usr ] ; then
[ -f /tmp/.delayed_mounted_tmp_clean ] || exit 0
rm /tmp/.delayed_mounted_tmp_clean
MOUNTPOINT=/tmp
fi
. /etc/default/rcS
cd "${MOUNTPOINT}" || exit 1
rm -f .X*-lock
case "${TMPTIME}" in
-*|infinite|infinity)
exit 0
;;
esac
if [ "${TMPTIME}" = "0" -o -z "${TMPTIME}" ]
then
TEXPR=""
DEXPR=""
else
TEXPR="-mtime +${TMPTIME} -ctime +${TMPTIME} -atime +${TMPTIME}"
DEXPR="-mtime +${TMPTIME} -ctime +${TMPTIME}"
fi
EXCEPT='! -name .
! ( -path ./lost+found -uid 0 )
! ( -path ./quota.user -uid 0 )
! ( -path ./aquota.user -uid 0 )
! ( -path ./quota.group -uid 0 )
! ( -path ./aquota.group -uid 0 )
! ( -path ./.journal -uid 0 )
! ( -path ./.clean -uid 0 )
! ( -path "./...security*" -uid 0 )'
# Remove all old files, then all empty directories
find . -depth -xdev $TEXPR $EXCEPT ! -type d -delete
find . -depth -xdev $DEXPR $EXCEPT -type d -empty -delete
# Check if we have enough space in /tmp, and if not, mount a tmpfs there
avail=`df -kP /tmp | awk 'NR==2 { print $4 }'`
if [ "$avail" -lt 1000 ]; then
mount -t tmpfs -o size=1048576,mode=1777 overflow /tmp
fi
end script
|