- 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.
推薦閱讀
- Learning Flask Framework
- Spring Boot+Spring Cloud+Vue+Element項目實戰:手把手教你開發權限管理系統
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第2版)
- Easy Web Development with WaveMaker
- 編譯系統透視:圖解編譯原理
- Java程序設計:原理與范例
- C語言課程設計
- Web Development with MongoDB and Node(Third Edition)
- LabVIEW虛擬儀器程序設計從入門到精通(第二版)
- Geospatial Development By Example with Python
- Oracle數據庫編程經典300例
- OpenCV 3.0 Computer Vision with Java
- 深入理解Kafka:核心設計與實踐原理
- Sitecore Cookbook for Developers
- C# 7 and .NET Core 2.0 Blueprints