--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi Peter,with the help of Jerrery, i got the below module and i modified it as per our requirement. So the below module will create a crontab on root user right ?# Generate the times when the cronjob will run
class cron_puppet {
$cron_time1= generate('/usr/bin/env', 'sh', '-c', "printf $(($(echo $::ipaddress | awk -F . \'{print \$1+\$2+\$3+\$4}\') % 30))")
$cron_time2 = $cron_time1 + 30cron { 'run-my-puppet-agent':
ensure => present,
command => /usr/local/sbin/puppetd --onetime --no-daemonize > /dev/null 2>&1,
minute => [$cron_time1, $cron_time2],
user => 'root',
}
}
If so, I would use a bash script that generates a pid-file like this:
http://www.xarg.org/2009/10/write-a-pid-file-in-bash/
That way, if the previous run is still running, you can skip doing it again and probably send out a notification that there are serious problems causing it to hang or run too long.
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)
I'm using such script to deal with this issue:
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SLEEP=$(($RANDOM*1500/32767))
sleep $SLEEP
puppetd -tv --report
But puppet commander, about which Krzysztof mentioned seems to be better solution. I have switch to it scheduled in my todo list too.
Best,
--
Dominik Zyla