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

Mon Oct 2 13:17:39 UTC 2017
Mark Haney <mark.haney at neonova.net>

On 10/01/2017 11:21 AM, 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.
What did you put in there that causes such issues in the first place?  
There shouldn't be a thing in that directory except the PID of the 
running process. It stands to reason that would be emptied on restart 
since the service would be shutdown cleanly (usually) before rebooting.

If you've got stuff in there that a) you need to keep across reboots 
and/or b) data that requires root access, you're simply not doing it 
right.  Might I suggest reading up on how CentOS/RHEL's directory 
structure and what should go where?  It seems to me you're trying to put 
a square peg in a round hole and getting frustrated because it won't fit.

Mark Haney
Network Engineer at NeoNova
919-460-3330 option 1
mark.haney at neonova.net