Skip to content

Commit

Permalink
Use code from sammcj/PR#2 to use systemd while keeping support for up…
Browse files Browse the repository at this point in the history
…start
  • Loading branch information
saimonn committed May 6, 2020
1 parent 47c9774 commit eec901a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
12 changes: 12 additions & 0 deletions files/csync2-inotify.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=csync2-inotify Service
After=xinetd.service

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/csync2-inotify
Restart=on-failure

[Install]
WantedBy=multi-user.target
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
{ ensure => $ensure }
)

file { '/etc/csync2':
ensure => directory,
}

#Csync2 needs xinetd
xinetd::service { 'csync2':
ensure => $ensure,
Expand All @@ -55,6 +59,7 @@
server_args => '-i',
flags => 'REUSE',
protocol => 'tcp',
require => File['/etc/csync2'],
}

}
36 changes: 28 additions & 8 deletions manifests/inotify.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,32 @@
content => template('csync2/inotify_body.erb'),
}

#Basic upstart init script for inotify
file { '/etc/init/csync2.conf':
ensure => $ensure,
source => 'puppet:///modules/csync2/csync2.conf',
require => File['/usr/local/bin/csync2-inotify'],
case $service_provider {

'upstart': {
#Basic upstart init script for inotify
file { 'csync2-service':
ensure => $ensure,
source => 'puppet:///modules/csync2/csync2.conf',
path => '/etc/init/csync2-inotify.conf',
require => File['/usr/local/bin/csync2-inotify'],
}
}

'systemd': {
#Basic upstart init script for inotify
file { 'csync2-service':
ensure => $ensure,
path => '/etc/systemd/system/csync2-inotify.service',
source => 'puppet:///modules/csync2/csync2-inotify.service',
require => File['/usr/local/bin/csync2-inotify'],
notify => Exec['reload-systemd'],
}
exec { 'reload-systemd':
command => '/usr/bin/systemctl daemon-reload',
refreshonly => true,
}
}
}

#Selector for turning 'present' to true
Expand All @@ -38,11 +59,10 @@
}

#Start the csync2 service
service { 'csync2':
service { 'csync2-inotify':
ensure => $service_ensure,
enable => $service_ensure,
require => File['/etc/init/csync2.conf'],
require => File['csync2-service'],
}


}

0 comments on commit eec901a

Please sign in to comment.