Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / etc / init / | server ip : 104.21.89.46 your ip : 108.162.241.220 H O M E |
Filename | /etc/init/mounted-tmp.conf |
Size | 1.85 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:50 |
Last modified | 22-Feb-2014 09:40 |
Last accessed | 06-Jul-2025 13:49 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
# 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
#
# 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