Skip to content
Advertisement

What is the proper place to put named pipes on Linux?

I’ve got a few processes that talk to each other through named pipes. Currently, I’m creating all my pipes locally, and keeping the applications in the same working directory. At some point, it’s assumed that these programs can (and will) be run from different directories. I need to create these pipes I’m using in a known location, so all of the different applications will be able to find the pipes they need.

I’m new to working on Linux and am not familiar with the filesystem structure. In Windows, I’d use something like the AppData folder to keep these pipes. I’m not sure what the equivalent is in Linux.

The /tmp directory looks like it probably could function just nicely. I’ve read in a few places that it’s cleared on system shutdowns (and that’s fine, I have no probably re-creating the pipes when I start back up.) but I’ve seen a few other people say they’re losing files while the system is up, as if it’s cleaned periodically, which I don’t want to happen while my applications are using those pipes!

Is there a place more suited for application specific stores? Or would /tmp be the place that I’d want to keep these (since they are after all, temporary.)?

Advertisement

Answer

I’ve seen SaltStack using /var/run. The only problem is that you need root access to write into that directory, but let’s say that you are going to run your process as a system daemon. SaltStack creates /var/run/salt at the installation time and changes the owner to salt so that later on it can be used without root privileges.

I also checked the Filesystem Hierarchy Standard and even though it’s not really important so much, even they say:

System programs that maintain transient UNIX-domain sockets must place them in this directory.

Since named pipes are something very similar, I would go the same way.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement