为 PID 文件创建 /var/run 文件夹,重启后消失?

Creating a /var/run folder for a PID file, disappears on reboot?

我正在 /var/run 中创建一个文件夹,它将存放我的服务的 PID 文件:

file { 'service_pid_folder': 
    path   => '/var/run/myservice',
    ensure => directory,
    owner  => $user,
    group  => $group,
}

这个运行没有任何问题。奇怪的是,当我重新启动我的机器并重新运行 puppet apply时,它会在每次重新启动时重新运行创建这个目录。

重启后,该目录不存在,很奇怪。如果我尝试以我的流程用户身份创建它,我会被拒绝许可。

为什么这个文件夹会在重启后消失?我的主机是 Ubuntu 14.04 服务器。

来自Filesystem Hierarchy Standard

This directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process.

您的系统似乎通过删除整棵树(或使用易变文件系统支持它)来实现此目的,我认为这是完全合法的。