This isn't really a Puppet problem, but regardless:
Those cron entries are for "every minute during the zeroth hour". So at 00:00 it will run, then at 00:01, then 00:02, and so on all the way to 00:59, then will stop until 00:00 the next day. Therefore, if the chmod/chown processes take more than 1 minute to run, they will stack up during that period of time.
The entry you want is "0 0 * * *" -- that will run exactly once, at 00:00 each day. In your manifest, you can express this with "hour => 0, minute => 0,".
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5543AC42.6020407%40alter3d.ca.
For more options, visit https://groups.google.com/d/optout.
On May 1, 2015, at 12:52 PM, Tim Dunphy <bluet...@gmail.com> wrote:This isn't really a Puppet problem, but regardless:
Those cron entries are for "every minute during the zeroth hour". So at 00:00 it will run, then at 00:01, then 00:02, and so on all the way to 00:59, then will stop until 00:00 the next day. Therefore, if the chmod/chown processes take more than 1 minute to run, they will stack up during that period of time.
The entry you want is "0 0 * * *" -- that will run exactly once, at 00:00 each day. In your manifest, you can express this with "hour => 0, minute => 0,".Ok got it! I've corrected it and this is what I have now:cron { "apache-chown":command => "/bin/chown -R apache:ftpgroup /var/www",user => 'root',hour => 0,minute => '0'}cron { "chmod-files":command => "/bin/find /var/www -type f -exec chmod -v 664 {} \;",user => 'root',hour => 0,minute => '0'}cron { "chmod-directories":command => "/bin/find /var/www -type d -exec chmod -v 775 {} \;",user => 'root',hour => 0,minute => '0'}Thanks for your input!Tim
In addition to Peter's excellent catch of the scheduling issue, depending on how many files you have in /var/www and how much other contention there is for disk I/O, your find commands could simply be getting bogged down traversing the directory tree. They are pretty inefficient, as written, so you should optimize them to minimize their impact.Instead of this command, which will run one chmod command for each matching file,/bin/find /var/www -type f -exec chmod -v 664 {} \;consider using the following command, which will exclude files that already have the correct permissions and will batch the found files into a single chmod command (note the plus sign instead of a semicolon):/bin/find /var/www -type f ! -perm 0644 -exec chmod -v 644 {} +The directory chmod command would look pretty much the same:/bin/find /var/www -type d ! -perm 0775 -exec chmod -v 775 {} +
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CB45AA5E-A8C1-4422-BA4E-2B8D8FEBB7F4%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAOZy0emPCpHn1pdU_-38W5AMO-%2B%2BXVdOmsUpHMwdw%3DEUF74Ggg%40mail.gmail.com.
Also you could consider wrapping these in a flock to prevent actions piling=
up behind each other - like described here:
http://www.elevatedcode.com/2013/05/07/flock-for-cron-jobs.html
Many other examples on the net.
Also you could consider wrapping these in a flock to prevent actions piling=
Hello
Looks like your intent is to run that daily?
I'd use cron.daily for that. That mean you script runs even if the server is not on at midnight.
what web applications do you run?
You do NOT generally want apache owning the web content. Apache should mostly have read access and only write to files it needs. That's storage areas in php apps etc. And those should be outside the webroot.
Looks like your users upload with ftp I'd do away with these checks and have you ftp server set the group and permissions so apache can read the files.
Neil