I'm using my system's tmp directory to store files that are only needed temporarily. Files are placed here using PHP's tmpfilenam()
(not sure if this is relevant).
How does my system determine when a file in this directory should be deleted? When the file is created, it's given a random string for its name. Is this string significant in determining when the file should be deleted?
There's a script that runs every day to clean up old files in /tmp
. /etc/periodic/daily/110.clean-tmps
deletes any files in /tmp
that haven't been accessed in 3 days. The script can be controlled using settings in /etc/defaults/periodic.conf
:
# 110.clean-tmps
daily_clean_tmps_enable="YES" # Delete stuff daily
daily_clean_tmps_dirs="/tmp" # Delete under here
daily_clean_tmps_days="3" # If not accessed for
daily_clean_tmps_ignore=".X*-lock .X11-unix .ICE-unix .font-unix .XIM-unix"
daily_clean_tmps_ignore="$daily_clean_tmps_ignore quota.user quota.group"
# Don't delete these
daily_clean_tmps_verbose="YES" # Mention files deleted
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.