Sample Header Ad - 728x90

Create a persistent temp directory with temporary content

1 vote
1 answer
2252 views
I wish to create a directory in $TMP_DIR or /tmp/ which persists forever (i.e. is never deleted) but it is maintained by OS, i.e. the content of which can be deleted if they have not been opened/used in a while or system needs more space. **Essentially directory to put random temporary stuff in and forget about maintaning it, but not having to recreate this directory anytime I want to use it and it's path doesn't change so scripts/application can use it.** What is the best way to achieve this? I can see in /etc/default/periodic.conf there're these options:
# 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
Can I add a path to daily_clean_tmps_ignore e.g. ...="my-persistant-unique-dir and it will respect it?
Asked by user14492 (933 rep)
Jul 22, 2020, 10:48 AM
Last activity: Jul 5, 2025, 04:08 AM