本帖最后由 andy 于 2009-10-16 14:59 编辑
vim /usr/local/nginx/sbin/log.conf //写入以下内容
rotate 48
nocompress
/home/logs/access.log {
sharedscripts
create 0644 www www
postrotate
/bin/kill -USR1 `cat /usr/local/nginx/var/nginx.pid`
LDATE=`date +%Y%m%d%H --date="-1 hour"`
/bin/mv /home/logs/access.log.1 /home/logs/${LDATE}-access_log
endscript
}
vim /usr/local/nginx/sbin/log.conf //写入以下内容
rotate 48
nocompress
/home/logs/access.log {
sharedscripts
create 0644 www www
postrotate
/bin/kill -USR1 `cat /usr/local/nginx/var/nginx.pid`
LDATE=`date +%Y%m%d%H --date="-1 hour"`
/bin/mv /home/logs/access.log.1 /home/logs/${LDATE}-access_log
endscript
}
0
执行命令后就出现下面的错误,查了资料也没搞明告白
[root@liu sbin]# /usr/sbin/logrotate /usr/local/nginx/sbin/log.conf
error: /usr/local/nginx/sbin/log.conf:6 unknown user 'www'
error: found error in /home/logs/access.log , skipping
error: /usr/local/nginx/sbin/log.conf:10 lines must begin with a keyword or a fi lename (possibly in double quotes)
error: /usr/local/nginx/sbin/log.conf:11 unknown option 'endscript' -- ignoring line
error: /usr/local/nginx/sbin/log.conf:12 unexpected }
[root@liu sbin]# /usr/sbin/logrotate /usr/local/nginx/sbin/log.conf
error: /usr/local/nginx/sbin/log.conf:6 unknown user 'www'
error: found error in /home/logs/access.log , skipping
error: /usr/local/nginx/sbin/log.conf:10 lines must begin with a keyword or a fi lename (possibly in double quotes)
error: /usr/local/nginx/sbin/log.conf:11 unknown option 'endscript' -- ignoring line
error: /usr/local/nginx/sbin/log.conf:12 unexpected }
编辑回复