AlmaLinux /tmp not cleared on reboot.

IT_Architect

Verified User
Joined
Feb 27, 2006
Messages
1,088
On line I see discussions all over the map including the use of tmpfs. I don't want to use tmpfs and I want the files to all get cleared out of /tmp on reboot like FreeBSD. I see scripts to remove files that haven't been access in a week, but I don't want that. Files that need to persist reboots are supposed to be in /var/tmp. I read about:
/usr/lib/tmpfiles.d/tmp.conf, called by systemd-tmpfiles-clean.service but when I look in the conf I don't see where it clears the files on reboot from a few folders it names. So my question is, how do I get AlmaLinux to clear /tmp?

Thanks!
 
If I'm correct then Almalinux is a 100% replacement/compatible of Centos 8.

So this would apply:
There are options in 3 files, not only in the tmp.conf file.

I just checked my Almalinux 8.4 which was converted from Centos 8.4 and found the conf file exactly there.
On my server as far as I could see not needed /tmp files were gone from /tmp after reboot.
 
Thank you for your reply. In /tmp no files are needed after reboot, in fact some use tempfs, which is a ram disk. Mine does not clear /tmp on reboot nor do the config files that I can see. The article just says you don't need to cron a script to get rid of old files as the server is up for months at a time. (hopefully :D)
 
in fact some use tempfs, which is a ram disk
Yep, I do too use something like it but it's not a ram disk as far as I know. I don't use the memory for it but disk space.
Protecting the /tmp folder so symlinking /home/tmp and /var/tmp to /tmp and it's a big file which is mounted as tmp.
Just in my case it's called TmpMnt and in CP it's called tmpDSK
The tmpfs is used for /dev/shm which I protected too in my DA servers by editting it in /etc/fstab and remounting.

In the older days, pre Centos 7 (so yes Centos 6) and maybe some other distro's, tmpwatch was used to clear /tmp which was called in a cron if I remember correctly.
 
I'll sort it out. I just want /tmp to be cleared in reboot and /var/tmp to persist. It seems the persistence of /var/tmp doesn't matter much with Linux like it does FreeBSD or they wouldn't be able to make it tmpfs/ram and then tie /var/tmp to it. Again I'm just getting into Linux again after well over a decade.
 
Back
Top