What is the place to host named pipes in Linux?

I have several processes that talk to each other through named pipes. Currently, I create all my channels locally and save the applications in one working directory. At some point, he suggested that these programs could (and would) be executed from different directories. I need to create these channels, which I use in a known place, so all the various applications can find the channels they need.

I am new to Linux and not familiar with the file system structure. On Windows, I would use something like an AppData folder to store these pipes. I am not sure what the equivalent is in Linux.

The /tmp looks as if it can function perfectly. I read in several places that it cleared when the system shut down (and, well, I probably don't recreate the pipes when backing up.), But I saw some other people say that they were losing files at that time how the system works, as if it was periodically cleaned, which I don’t want to do while my applications use these channels!

Is there a place more suitable for app stores? Or will /tmp be the place I would like to keep (since they are ultimately temporary.)?

+8
linux filesystems pipe named-pipes tmp
source share
2 answers

I saw SaltStack using /var/run . The only problem is that you need root access to write to this directory, but let me say that you are going to start your process as a system daemon. SaltStack creates /var/run/salt during installation and changes the owner to salt so that it can later be used without root privileges.

I also checked the File System Hierarchy Standard, and even though this is not very important, even they say:

System programs that support UNIX domain transition sockets must place them in this directory.

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

+7
source share

In new Linux distributions with systemd /run/user/<userid> (created by pam_systemd during login, if it does not already exist), you can use it to open sockets and place .pid files instead of /var/run , where only root is available . Also note that /var/run is a symbolic link to /run , so /var/run/user/<userid> can also be used. See this topic for more information. The idea is that system daemons should have the /var/run/<daemon name>/ directory created during installation with the proper permissions and put their socket files / pid there, while daemons run by the user (for example, pulseaudio) must use /run/user/<userid>/ . Another option is /tmp and /var/tmp .

+3
source share

All Articles