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

Wed Oct 4 14:33:30 UTC 2017
Gordon Messmer <gordon.messmer at gmail.com>

On 10/04/2017 01:23 AM, Gary Stainburn wrote:
> There is a solution that saves /var/run to disk at shutdown and restores it at
> bootup but I can't remember what it is.

The simplest solution that comes to mind at 7:30am is simply bind 
mounting a directory that's persistent.  You'll still need to define 
that directory using tmpfiles.d, but...

    echo "D /var/run/mariadb 0755 root root -" >
    mkdir /var/run-persistent/mariadb -p
    echo "/var/run-persistent/mariadb /var/run/mariadb none bind 0 0" >>

Obviously, test this somewhere before you do it to a system you care 
about.  It's early, and I haven't.  I'm not sure startup ordering will 
be correct for this sort of thing...