5

Any added files or folders in /var/run they are deleted when I restart my machine. Why is this happening? What should I do to ensure these files are not deleted (or are recreated) and how would I go about doing this?

Any help appreciated

1 Answer 1

8

/var/run is mounted as tmpfs. That means it's totally empty when your machine boots and it's meant to be like this to prevent stuff like daemons not starting because of a left-over PID-file. Startup scripts usually create the directories they need in there before using them. If you want to store a PID-file either put it in /var/run directly or create a directory before creating the PID-file. This is no place to store data that needs to remain there across reboots.

3
  • Hi Ismooth, thanks for your answer. I am using it to store a PID-file, but the directory I create within the /var/run directory is deleted whenever I restart my mac. Is there a way of ensuring this folder is not removed or is recreated on startup? Feb 21, 2013 at 1:00
  • 1
    @simpleengine Either don't create a directory at all, or re-create it at startup. Feb 21, 2013 at 1:37
  • I'm not familiar with Mac, but there must be some documentatinon on how to handle such a situation. Or trawl through the configuration of other daemons to pilfer the way of doing it from there.
    – vonbrand
    Feb 21, 2013 at 3:37

You must log in to answer this question.

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