-1

This gets run every minute:

cd /var/www/html/[redacted] && find . -exec touch -a -m -t 200001010000.00 {} \;
tac /log/[redacted] > /var/www/html/[redacted]
chmod 775 -R /var/www/
chown www-data:webadmins -R /var/www/
exit 0

I feel like that's bad, but I don't really know.

  • please don't drive-by downvote! – TheSqrtMinus1 Apr 17 '16 at 02:29
  • 1
    You can have `find` filter out files that don't need to be touched, using `-newermt date_string`, and `-not -newermt` to bracket to a 1 sec window or something. **Also** `touch` can take multiple file arguments, so you can reduce the amount of process-startup overhead by a huge factor by using GNU `find`'s `find \( -newerXY ... -not -newerXY ... \) -exec touch ... {} +`. Note the `+` instead of `\;`. It's like xargs, but built into find. This will make it a lot cheaper, esp. if you avoid having chmod and chown do any disk writes when no change is needed, but it still seems silly. – Peter Cordes Apr 17 '16 at 07:36

1 Answers1

1

You will be changing quite a bit of inodes every minute and generating I/O due to the concatenations. So I think it all depends on the number of files/dirs being operated on.

pgngp
  • 1,552
  • 5
  • 16
  • 26