>
> 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 {} +
>


That's some pretty wonderful advice! I'll admit that my use of the find
command may not have been that sophisticated. But I think you're example
will help me with a better approach that I hope to learn from!

Thanks!

Tim

On Fri, May 1, 2015 at 1:06 PM, Peter Bukowinski <[email protected]> wrote:

> On May 1, 2015, at 12:52 PM, Tim Dunphy <[email protected]> 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 {} +
>
> --
> Peter Bukowinski
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CB45AA5E-A8C1-4422-BA4E-2B8D8FEBB7F4%40gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CB45AA5E-A8C1-4422-BA4E-2B8D8FEBB7F4%40gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOZy0emPCpHn1pdU_-38W5AMO-%2B%2BXVdOmsUpHMwdw%3DEUF74Ggg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to