diff --git a/manifests/install.pp b/manifests/install.pp index c291606..b0674e3 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -10,5 +10,14 @@ class rsnapshot::install { ensure => $rsnapshot::package_ensure, } + # ensure run directory exists (systemd clears /var/run, so rsnapshot can't create PID files after reboot - issue#12) + $lockpath = pick($rsnapshot::lockpath, $rsnapshot::params::config_lockpath, '/var/run/rsnapshot') + $tmpfiles_d = '/etc/tmpfiles.d' + + file { "${tmpfiles_d}/rsnapshot.conf": + ensure => present, + content => "D ${lockpath} 0755 root root -", + } + } diff --git a/spec/acceptance/default_spec.rb b/spec/acceptance/default_spec.rb index ecd4754..5a49c34 100644 --- a/spec/acceptance/default_spec.rb +++ b/spec/acceptance/default_spec.rb @@ -28,6 +28,10 @@ describe 'rsnapshot' do end end context 'files provisioned' do + describe file('/etc/tmpfiles.d/rsnapshot.conf') do + it { is_expected.to exist } + its(:content) { is_expected.to match 'D /var/run/rsnapshot 0755 root root -' } + end describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do it { is_expected.to exist } its(:content) { is_expected.to match 'backup' }