- 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.
推薦閱讀
- 大學(xué)計算機(jī)基礎(chǔ)(第三版)
- 零基礎(chǔ)搭建量化投資系統(tǒng):以Python為工具
- LabVIEW2018中文版 虛擬儀器程序設(shè)計自學(xué)手冊
- Learning SAP Analytics Cloud
- 數(shù)據(jù)結(jié)構(gòu)(Python語言描述)(第2版)
- Responsive Web Design by Example
- Java網(wǎng)絡(luò)編程實(shí)戰(zhàn)
- 實(shí)戰(zhàn)Python網(wǎng)絡(luò)爬蟲
- TypeScript全棧開發(fā)
- 企業(yè)級Java現(xiàn)代化:寫給開發(fā)者的云原生簡明指南
- Docker on Windows
- C++標(biāo)準(zhǔn)庫(第2版)
- 瘋狂Java講義精粹
- 片上系統(tǒng)設(shè)計思想與源代碼分析
- 從零開始:Qt可視化程序設(shè)計基礎(chǔ)教程