访问日志放到/app/logs 目录,请按日期对 nginx 访问日志(access
log)实施按天日志轮询。
[[email protected] www_logs]# cat /server/scripts/logs_poll.sh
#!/bin/sh #print for poll nginx logs by yvonne 2015-7-5 21:15:37. DIR=/application/nginx/logs/ [ -d $DIR ] && cd $DIR ||exit 1 [ -f access.log ] ||exit 1 /bin/mv access.log access_$(date +%F).log [ -d $DIR ] && cd $DIR ||exit 1 [ -f error.log ] || exit 1 /bin/mv error.log error_$(date +%F).log [ -d $DIR ] && cd $DIR ||exit [ -f access_www.log ] ||exit 1 /bin/mv access_www.log access_www_$(date +%F).log [ -d $DIR ] && cd $DIR ||exit [ -f access_bbs.log ] ||exit 1 /bin/mv access_bbs.log access_bbs_$(date +%F).log [ -d $DIR ] && cd $DIR ||exit [ -f access_blog.log ] ||exit 1 /bin/mv access_blog.log access_blog_$(date +%F).log
"/server/scripts/logs_poll.sh" 21L, 781C written
[[email protected] www_logs]#
[[email protected] www_logs]#
[[email protected] www_logs]# /bin/sh /server/scripts/logs_poll.sh logs_test.sh
[[email protected] www_logs]# /bin/sh /server/scripts/logs_poll.sh
时间: 2024-10-25 19:15:37