diff --git a/puppet/files/puppet-check b/puppet/files/puppet-check index 2fe60ca..fe1db2b 100755 --- a/puppet/files/puppet-check +++ b/puppet/files/puppet-check @@ -5,8 +5,16 @@ require "socket" Puppet.parse_config +if Puppet.version[/\d+/].to_i >= 2 + puppetd = "puppet agent" + pidname = "agent.pid" +else + puppetd = "puppetd" + pidname = "puppetd.pid" +end + # get pid number for puppet or exit if not found -pidfile = Puppet.settings.value("rundir") + "/puppetd.pid" +pidfile = File.join(Puppet.settings.value("rundir"), pidname) begin pid = File.new(pidfile, "r").read.to_i rescue Errno::ENOENT @@ -27,5 +35,5 @@ printf("puppetd dead but pid file exists on host '%s', restarting\n", begin exec("service puppet start") rescue Errno::ENOENT - exec("puppetd") + exec(puppetd) end