- Puppet 5 Essentials(Third Edition)
- Martin Alfke Felix Frank
- 200字
- 2021-07-02 18:22:26
Running the agent from cron
There is an alternative way to operate the agent. We covered starting one long-running puppet agent process that does its work in set intervals and then goes back to sleep. However, it is also possible to have cron launch a discrete agent process in the same interval. This agent will contact the master once, run the received catalog, and then terminate. This has several advantages, as follows:
- The agent operating system saves resources
- The interval is precise and not subject to skew (when running the background agent, deviations result from the time that elapses during the catalog run), and distributed interval skew can lead to thundering herd effects
- Any agent crash or an inadvertent termination is not fatal
Setting Puppet to run the agent from cron is also very easy to do with Puppet! You can use a manifest like the following:
service { 'puppet': enable => false, }
cron { 'puppet-agent-run':
user => 'root',
command => 'puppet agent --no-daemonize --onetime --logdest=syslog',
minute => fqdn_rand(60),
hour => absent,
}
The fqdn_rand function computes a distinct minute for each of your agents. Setting the hour property to absent means that the job should run every hour.
推薦閱讀
- iOS Game Programming Cookbook
- Spring Cloud Alibaba核心技術與實戰案例
- Java面向對象思想與程序設計
- Mastering Swift 2
- Unity Shader入門精要
- 零基礎學Python網絡爬蟲案例實戰全流程詳解(高級進階篇)
- PHP 7+MySQL 8動態網站開發從入門到精通(視頻教學版)
- Java EE企業級應用開發教程(Spring+Spring MVC+MyBatis)
- C++編程兵書
- 機器學習微積分一本通(Python版)
- C++從入門到精通(第6版)
- Hack與HHVM權威指南
- 實驗編程:PsychoPy從入門到精通
- Yii2 By Example
- Android應用程序設計