#! / bin / the bash nginx_root = / WWW / Server / Nginx log_path, = / WWW / wwwlogs Yesterday DATE = `-d" Day -1 "+ m%%% d` the Y mkdir log_path, $ / $ Yesterday # moved to a new log location cd $ log_path for name in `LS * .log` do mv $ name $ log_path / $ Yesterday / $ name DONE # deleted 60 days prior to logging the Find the -type d -mtime +60 |. xargs RM -rf # re reload nginx $ nginx_root / sbin / nginx -s reload