Mik*_*ott 31
在客户端上,编辑 /etc/puppet/puppet.conf 并在文件的 [main] 部分中设置以下内容(如果尚不存在,则添加一个新行):
runinterval=xxx
Run Code Online (Sandbox Code Playgroud)
其中 xxx 是您所需的轮询间隔(以秒为单位)。
傀儡代理应用目录的频率。请注意,runinterval 为 0 表示“连续运行”而不是“从不运行”。如果您希望 puppet 代理永远不会运行,您应该使用 --no-client 选项启动它。此设置可以是以秒(30 或 30 秒)、分钟 (30m)、小时 (6h)、天 (2d) 或年 (5y) 为单位的时间间隔。
Default: 30m
Run Code Online (Sandbox Code Playgroud)
如果你想避免使用 runinterval,设置一个 cron 可能会很好地工作。如果您想避免同时攻击您的傀儡主人的许多服务器,这可能特别有用。我使用 puppetmaster 推出文件并更新 cron,与客户端无关(显然)。
这是我正在使用的内容(请注意,我每小时运行一次,但您可以在 cron.d 中引用它,我没有创建此脚本,不幸的是不知道该归功于谁):
#!/bin/bash
#/etc/cron.hourly/puppetRun.sh
# This file managed by Puppet.
# Leave this script in cron. To disable Puppet, run 'puppetd --disable'
# to temporarily suspend the running of Puppet for testing purposes.
PROG=`basename $0 .sh`
exec > /usr/local/logs/${PROG}.last.trace 2>&1
set -x
if [ -e "/var/run/puppet/puppetd.pid" ]; then
echo "Puppet is already running or has been disabled. Remove the lock file /var/run/puppet/puppetd.pid or run
'puppetd --enable'."
exit
fi
# Randomly sleep so all Puppet clients don't hit the Puppet Master at once.
WAIT=$((RANDOM % 60 * 60))
echo "Sleeping $WAIT seconds..."
/bin/sleep $WAIT
/usr/sbin/puppetd --onetime --no-daemonize --logdest syslog > /dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)