2

I'm a bit confused as to see that going from one Linux distribution to another, the package managers will sometimes configure processes to create the socket file either in /tmp or in /var/run/%process%, but I'm seeing it as a standard in open source projects that you configure your applications to refer to the socket in /tmp, as if to normalize the two options.

I too have chosen to distribute a project's configuration to refer to the socket in /tmp. Now I'd like to know, for the sake of not overriding the defaults, if I'd like to link a socket from /var/run into /tmp, is there a safe way to do that?

I'm mostly asking this because I wouldn't like somebody to deal with spurious application errors because the /tmp directory got wiped clean and the socket link is no longer there.

1 Answer 1

3

/tmp is not a "standard"0 anymore for system daemons; the only program in wide use1 that still puts sockets there is Xorg. All other daemons use /run or /var/run for this – precisely to avoid such problems as periodic /tmp cleaning or possible name collisions with user-created sockets.

There is no standard method of cleaning /tmp or excluding files from said cleanup.


0 The Filesystem Hierarchy Standard (FHS) has never defined /tmp for anything else but temporary files.

1 That I know of.

1
  • 1
    I did some quick googling and found that MySQL and MongoDB will put the socket in /tmp by default. These are just small samples, but it goes to show that you can't specify a fixed path to the socket, which is why I'm assuming a lot of applications roll out with configurations that simply point to the socket in /tmp (say for those that expect to work with a MySQL socket). It's a bit of a hairy situation if there really is no safe way to link it! May 5, 2012 at 11:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .