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

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.

主站蜘蛛池模板: 阳江市| 宁海县| 九龙城区| 永川市| 白城市| 伊川县| 垫江县| 潮州市| 湛江市| 许昌市| 河南省| 蒙山县| 广汉市| 信宜市| 左权县| 镇巴县| 东安县| 淮安市| 子洲县| 丽江市| 惠州市| 长海县| 兰州市| 凭祥市| 阳城县| 民丰县| 揭西县| 乾安县| 揭阳市| 吐鲁番市| 始兴县| 阜平县| 信阳市| 马山县| 德令哈市| 望城县| 榆中县| 松溪县| 沂水县| 秦安县| 阳原县|