I created a service that would make the dir at start:
vim /etc/systemd/system/mydaemon-helper.service
The contents of /etc/systemd/system/mydaemon-helper.service
:
[Unit]
Description=MyDaemon Helper Simple Service
After=network.target
[Service]
Type=simple
ExecStartPre=-/usr/bin/mkdir /var/run/mydaemon
ExecStart=/usr/bin/chown myuser:myuser /var/run/mydaemon
Restart=on-abort
[Install]
WantedBy=multi-user.target
Then I started this service:
systemctl start mydaemon-helper
systemctl status mydaemon-helper
Output:
[root@alpha etc]# systemctl status mydaemon-helper.service
● mydaemon-helper.service - MyDaemon Helper Simple Service
Loaded: loaded (/etc/systemd/system/mydaemon-helper.service; disabled; vendor preset: disabled)
Active: inactive (dead)
May 28 20:53:50 alpha systemd[1]: Starting MyDaemon Helper Simple Service...
May 28 20:53:50 alpha systemd[1]: Started MyDaemon Helper Simple Service.
Lastly I told the system to load it on startup:
systemctl enable mydaemon-helper