Skip to content

Instantly share code, notes, and snippets.

@raphink
Created April 25, 2012 11:04
Show Gist options
  • Save raphink/2488967 to your computer and use it in GitHub Desktop.
Save raphink/2488967 to your computer and use it in GitHub Desktop.
onlyif not honored in Exec
exec {'Avoid multiple mcollectived':
path => '/usr/bin:/usr/sbin:/bin',
command => 'pkill -f mcollectived',
onlyif => 'test `pgrep -f mcollectived | wc -l` -gt 1',
notify => Service['mcollective'],
}
@rgevaert
Copy link

which version of puppet? I think I'm seeing the same 2.7.6

@rgevaert
Copy link

this now works:

class perdition::service::xinetd
{
  exec {
    'killperditiondaemon':
      path    => '/usr/bin',
      command  => 'pkill -f "[p]erdition.*: daemon"',
      onlyif  => 'pgrep -f "[p]erdition.*daemon"';
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment