What about something like this.
file { "/tmp/your_crontab_file": ensure => present, source => your_source, before => Correct_crontab['ensure_correct_cron'] } correct_crontab { "ensure_correct_crontab": } define correct_crontab { exec { "command you want to run": path ["/path/you/need/here"], unless => "`diff /tmp/your_crontab_file /etc/crontab > /dev/null 2>&1`", } } It would put your cron source in a temp dir, and execute a command for updating your crontab only if the crontab and the source is different. Regards 2009/4/17 Ian Burrell <ianburr...@gmail.com> > > Is there a way to copy a source file to a temporary location? Or to > download a file by comparing it to a different file? The problem I am > trying to solve is updating crontabs when the source file changes. > Our crontab files are checked into version control, synced by "file" > to a temp file, and applied with "crontab". For various reasons, we > can't use the cron type. > > define crontab($host = $hostname) { > $path = "/tmp/$name.$host.cron" > remotefile { $path: > source => "operations/cron/$host/$name.cron", > } > exec { "crontab-$name": > command => "crontab -u $name $path", > subscribe => File[$path], > refreshonly => true, > } > } > > The problem is it compares the source file to the temp file. If is the > crontab is changed manually, this doesn't notice. In fact, it only > syncs when the temp file is deleted weekly by tmpwatch. It should be > possible to compare the source file with /var/spool/cron/$name. I > would prefer to use the "crontab" command to install it which means > downloading to a temp file. I am guessing that the issue shows up with > other files that need to be installed with a command. > > - Ian > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---