官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 衡阳县| 望城县| 驻马店市| 通道| 阳山县| 石棉县| 黄浦区| 仪征市| 油尖旺区| 沧源| 连云港市| 闵行区| 潼关县| 潼南县| 漠河县| 容城县| 水富县| 玛多县| 曲阳县| 佛学| 五大连池市| 长寿区| 绿春县| 疏附县| 巴彦县| 封开县| 乡宁县| 永兴县| 天等县| 武功县| 潼南县| 宁德市| 营口市| 玉田县| 甘谷县| 蒲江县| 芜湖市| 南宫市| 陆川县| 邳州市| 保亭|