How to make Fedora Linux not clean some files in /tmp/?

On my Fedora 20, I find that the system automatically clean up file under /tmp/. This is convenient. However, it cause some problems for some programs.

For example, HDFS puts its DataNode pid file under /tmp/ by default like hadoop-hadoop-datanode.pid. After it is cleaned up, the hadoop-daemon.sh script will consider there is no DataNode running.

How to make Fedora Linux not clean some files in /tmp/?

systemd has a systemd-tmpfiles tool that creates, deletes and cleans up volatile and temporary files and directories.

You can control the behavior of the systemd-tmpfiles by configuring its configuration file located at

/usr/lib/tmpfiles.d/tmp.conf

Check the tmpfiles.d for the format of configuration.

For the purpose of excluding *.pid files, you can add one line as follows

x /tmp/*.pid
Answered by Eric Z Ma.

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *