0

我正在 puppet 代理端执行一个 shell 脚本。如果我在本地机器上执行相同的 shell 脚本,它将向终端打印几条日志消息。但是当我在 puppet 代理中执行它时,它不会将任何日志打印到代理终端。

当我使用 puppet 运行 shell 脚本时,如何打印它的日志?

我正在使用以下命令来执行 shell 脚本。

exec { "strating":
    user    => 'root',
    environment => 'JAVA_HOME=/home/malintha/jdk1.6.0',
    path        => $command_path,
    command => "/pathToShellScript/myScript.sh",
    logoutput => true,
    timeout => 3600,
    require => Exec['another goal'],
}

注意:我设置logoutput => true

4

1 回答 1

0

您可以将--debug标志添加到 puppet 命令。

 puppet agent --test --debug

或者,您也可以将元参数设置loglevelinfoor notice

 exec { 'starting':
   path      => $command_path,
   command   => '/path/to/script.sh',
   logoutput => true,
   loglevel  => info
 }

请参阅以下输出:

 [~]$ puppet apply --verbose test.pp
 Notice: Compiled catalog for dpsmqm009.local in environment production in 0.03 seconds
 Info: Applying configuration version '1403302144'
 Info: /Stage[main]/Main/Exec[starting]/returns: testing
 Info: /Stage[main]/Main/Exec[starting]/returns: testing again
 Info: /Stage[main]/Main/Exec[starting]/returns: testing some more
 Info: /Stage[main]/Main/Exec[starting]/returns: executed successfully
 Notice: Finished catalog run in 0.20 seconds

参考

http://docs.puppetlabs.com/references/latest/metaparameter.html#loglevel

于 2014-06-20T22:13:03.483 回答