1753830 Members
9705 Online
108806 Solutions
New Discussion юеВ

Re: Housekeep script

 
Fenglin
Regular Advisor

Housekeep script

Hi

Can anyone explain to me what is the attached script doing?

Whats the meaning of
find /app/httpd -type f -mtime +2 -mtime +4 -exec basename {} \; > /root/temp1
?
Regards
Feng Lin
2 REPLIES 2
Steven Schweda
Honored Contributor

Re: Housekeep script

man find
man basename

It appears to be looking in "/app/httpd" for
plain files of a certain age range, and
storing their base names into "/root/temp1".
Dennis Handly
Acclaimed Contributor

Re: Housekeep script

>-mtime +2 -mtime +4

Repeating both of these is useless with the AND, it only does the latter, modified in more than 4 days. If they wanted between 2 and 4, it should use: -mtime +2 ! -mtime +4

Then if there isn't a .md5 file, it gzips that file. And then if no .md5 file, it creates one.

Then it removes everything older than 180 days.