简体   繁体   English

如何查找执行人偶清单的时间

[英]How to find the time when a Puppet manifest is executed

I'm wondering if anyone knows a good way to get the date and time when a portion of code in a Puppet manifest is actually executed . 我想知道是否有人知道当执行 Puppet清单中的部分代码时获得日期和时间的好方法。 Sometimes my manifests take a long time to run, and I need to schedule a task to occur soon after the end of the run, no matter when that occurs. 有时我的清单需要花费很长时间才能运行,并且我需要安排任务在运行结束后立即执行,无论何时发生。

I have tried the time() function, setting a variable using generate() (using the date function on the Puppet master), and even creating a custom fact, but everything I've tried gets evaluated when the manifests are parsed on the server, rather than when they actually execute on the client. 我尝试了time()函数,使用generate()设置了变量(使用Puppet主机上的date函数),甚至创建了一个自定义事实,但是我尝试过的所有东西都会在服务器上解析清单时得到评估,而不是它们在客户端上实际执行的时间。

Any ideas? 有任何想法吗? The clients are all Windows, FWIW. 客户端都是Windows,FWIW。

Thanks in advance! 提前致谢!

I am not sure I understand what you mean, but you can't get this information during catalog compilation (obviously), so you can't use it to change the way the catalog will be applied. 我不确定我理解您的意思,但是(显然)您在目录编排期间无法获得此信息,因此您不能使用它来更改目录的应用方式。

If you need to trigger another process on the same host, then you should use any IPC mechanism you have available. 如果需要在同一主机上触发另一个进程,则应使用任何可用的IPC机制。 You can exec anything, and have it happen just after any other resources is applied, so it is just a matter of finding the proper command. 您可以exec任何命令,并在应用任何其他资源后立即exec它,因此这只是找到适当命令的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM