Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

60%
+1 −0
Q&A Who creates subdirs under `/run`?

A system daemon needs to create several files under /run/program-name/ (and possibly other subdirs of that). They are the PID file, and at least one Unix socket file (but maybe more). The FHS spe...

1 answer  ·  posted 1y ago by alx‭  ·  edited 1y ago by alx‭

Question unix /run
#3: Post edited by user avatar alx‭ · 2022-08-17T11:54:13Z (over 1 year ago)
  • A system daemon needs to create several files under `/run/program-name/` (and possibly other subdirs of that). They are the PID file, and at least one Unix socket file (but maybe more). The FHS specifies that those files go there, under a `/run` subdir: <https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html#runRequirements>. (In some Unix systems, it would still be `/var/run` instead of `/run`, but the same question applies.)
  • But who is responsible for the creation of the dir(s)? Should the daemon call the equivalent of `mkdir -p` right before `open(..., O_CREAT)` or *bind(2)*? Or should the sysadmin make sure that the directory exist before the daemon runs, by configuring *systemd-tmpfiles(8)* or equivalent (e.g., an rc script, or the docker entrypoint), and the daemon assume that the directory exists (and fail if it doesn't)? Or both (i.e., the sysadmin makes sure the dir exists, but the daemon still calls *mkdir(2)* just in case to avoid failing)?
  • A system daemon needs to create several files under `/run/program-name/` (and possibly other subdirs of that). They are the PID file, and at least one Unix socket file (but maybe more). The FHS specifies that those files go there, under a `/run` subdir: <https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html#runRequirements>. (In some Unix systems, it would still be `/var/run` instead of `/run`, but the same question applies.)
  • But who is responsible for the creation of the dir(s)? Should the daemon call the equivalent of `mkdir -p` right before `open(..., O_CREAT)` or *bind(2)*? Or should the sysadmin make sure that the directory exists before the daemon runs, by configuring *systemd-tmpfiles(8)* or equivalent (e.g., an rc script, or the docker entrypoint), and the daemon assume that the directory exists (and fail if it doesn't)? Or both (i.e., the sysadmin makes sure the dir exists, but the daemon still calls *mkdir(2)* just in case to avoid failing)?
#2: Post edited by user avatar alx‭ · 2022-08-16T09:56:51Z (over 1 year ago)
  • A system daemon needs to create several files under `/run/program-name/` (and possibly other subdirs of that). They are the PID file, and at least one Unix socket file (but maybe more). The FHS specifies that those files go there, under a `/run` subdir: <https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html#runRequirements>. (In some Unix systems, it would still be `/var/run`, but the same question applies.)
  • But who is responsible for the creation of the dir(s)? Should the daemon call the equivalent of `mkdir -p` right before `open(..., O_CREAT)` or *bind(2)*? Or should the sysadmin make sure that the directory exist before the daemon runs, by configuring *systemd-tmpfiles(8)* or equivalent (e.g., an rc script, or the docker entrypoint), and the daemon assume that the directory exists (and fail if it doesn't)? Or both (i.e., the sysadmin makes sure the dir exists, but the daemon still calls *mkdir(2)* just in case to avoid failing)?
  • A system daemon needs to create several files under `/run/program-name/` (and possibly other subdirs of that). They are the PID file, and at least one Unix socket file (but maybe more). The FHS specifies that those files go there, under a `/run` subdir: <https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html#runRequirements>. (In some Unix systems, it would still be `/var/run` instead of `/run`, but the same question applies.)
  • But who is responsible for the creation of the dir(s)? Should the daemon call the equivalent of `mkdir -p` right before `open(..., O_CREAT)` or *bind(2)*? Or should the sysadmin make sure that the directory exist before the daemon runs, by configuring *systemd-tmpfiles(8)* or equivalent (e.g., an rc script, or the docker entrypoint), and the daemon assume that the directory exists (and fail if it doesn't)? Or both (i.e., the sysadmin makes sure the dir exists, but the daemon still calls *mkdir(2)* just in case to avoid failing)?
#1: Initial revision by user avatar alx‭ · 2022-08-16T09:55:36Z (over 1 year ago)
Who creates subdirs under `/run`?
A system daemon needs to create several files under `/run/program-name/` (and possibly other subdirs of that).  They are the PID file, and at least one Unix socket file (but maybe more).  The FHS specifies that those files go there, under a `/run` subdir: <https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html#runRequirements>.  (In some Unix systems, it would still be `/var/run`, but the same question applies.)

But who is responsible for the creation of the dir(s)?  Should the daemon call the equivalent of `mkdir -p` right before `open(..., O_CREAT)` or *bind(2)*?  Or should the sysadmin make sure that the directory exist before the daemon runs, by configuring *systemd-tmpfiles(8)* or equivalent (e.g., an rc script, or the docker entrypoint), and the daemon assume that the directory exists (and fail if it doesn't)?  Or both (i.e., the sysadmin makes sure the dir exists, but the daemon still calls *mkdir(2)* just in case to avoid failing)?