[CentOS] how to prevent files and directories from being deleted?

Mon Oct 9 12:47:49 UTC 2017
hw <hw at adminart.net>

Harold Toms <h.toms at qmul.ac.uk> writes:

> On 01/10/17 16:21, hw wrote:
>> Hi,
>> how can I prevent files/directories like /var/run/mariadb from being
>> deleted on reboot?  Lighttpd has the same problem.
>> This breaks services and makes servers non-restartable by anyone else
>> but the administrator who needs to re-create the needed files and
>> directories every time and has to figure out what selinux labels they
>> need.  This causes unnecessary downtimes.
>> This is entirely inacceptable.  This totally sucks.
> Assuming that your /usr/lib/tmpfiles.d/mariadb.conf file contains:
> d /var/run/mariadb 0755 mysql mysql -

Thanks!  There is no such file.

Apparently we are not supposed to create such files, and now I must
compile mariadb from source because otherwise I wouldn´t be following
best practises an be out of my right mind ... ;)

Somehow, I doubt I would have a file like that if I did that.  I might
even get stuck in a compiling loop, following best practises
indefinitely ...

> the /var/run/mariadb should be recreated on every reboot... if it is
> not, perhaps either the mysql user or group do not exist. Check
> /etc/passwd and /etc/group.

They do exist.

The server isn´t in production yet, so I can create the file and see
what happens when rebooting it.  Let´s hope that it doesn´t vanish when
I do that ...

"Didn't work" is an error.