error_log cannot be reopened when kill a USR1 signal

任晓磊 julyclyde at gmail.com
Fri Oct 9 07:12:12 MSD 2009


[root at tupian_web logs]# ls -l /proc/`cat nginx.pid `/fd
total 15
lrwx------  1 root root 64 Oct  9 11:08 0 -> /dev/null
lrwx------  1 root root 64 Oct  9 11:08 1 -> /dev/null
lrwx------  1 root root 64 Oct  9 11:08 10 -> socket:[52975564]
lrwx------  1 root root 64 Oct  9 11:08 11 -> socket:[52975565]
lrwx------  1 root root 64 Oct  9 11:08 12 -> socket:[52975566]
lrwx------  1 root root 64 Oct  9 11:08 13 -> socket:[52975569]
lrwx------  1 root root 64 Oct  9 11:08 14 -> socket:[52975570]
l-wx------  1 root root 64 Oct  9 11:08 2 -> /usr/local/nginx/logs/error.log
l-wx------  1 root root 64 Oct  9 11:08 3 -> /usr/local/nginx/logs/error.log
l-wx------  1 root root 64 Oct  9 11:08 4 ->
/usr/local/nginx/logs/host.access.log
l-wx------  1 root root 64 Oct  9 11:08 5 -> /usr/local/nginx/logs/error.log
lrwx------  1 root root 64 Oct  9 11:08 6 -> socket:[52975557]
lrwx------  1 root root 64 Oct  9 11:08 7 -> socket:[52975560]
lrwx------  1 root root 64 Oct  9 11:08 8 -> socket:[52975561]
lrwx------  1 root root 64 Oct  9 11:08 9 -> socket:[52975563]
[root at tupian_web logs]# mv error.log error.log.1
[root at tupian_web logs]# mv host.access.log host.access.log.1
[root at tupian_web logs]# kill -USR1 `cat nginx.pid `
[root at tupian_web logs]# ls -l
total 648
-rw-r--r--  1 nobody root      0 Oct  9 11:08 error.log
-rw-r--r--  1 root   root    941 Oct  9 11:07 error.log.1
-rw-r--r--  1 nobody root  14521 Oct  9 11:08 host.access.log
-rw-r--r--  1 root   root 633729 Oct  9 11:08 host.access.log.1
-rw-r--r--  1 root   root      6 Oct  9 11:07 nginx.pid
[root at tupian_web logs]# ls -l /proc/`cat nginx.pid `/fd
total 15
lrwx------  1 root root 64 Oct  9 11:08 0 -> /dev/null
lrwx------  1 root root 64 Oct  9 11:08 1 -> /dev/null
lrwx------  1 root root 64 Oct  9 11:08 10 -> socket:[52975564]
lrwx------  1 root root 64 Oct  9 11:08 11 -> socket:[52975565]
lrwx------  1 root root 64 Oct  9 11:08 12 -> socket:[52975566]
lrwx------  1 root root 64 Oct  9 11:08 13 -> socket:[52975569]
lrwx------  1 root root 64 Oct  9 11:08 14 -> socket:[52975570]
l-wx------  1 root root 64 Oct  9 11:08 15 ->
/usr/local/nginx/logs/host.access.log
l-wx------  1 root root 64 Oct  9 11:08 2 -> /usr/local/nginx/logs/error.log
l-wx------  1 root root 64 Oct  9 11:08 3 -> /usr/local/nginx/logs/error.log.1
l-wx------  1 root root 64 Oct  9 11:08 4 -> /usr/local/nginx/logs/error.log
lrwx------  1 root root 64 Oct  9 11:08 6 -> socket:[52975557]
lrwx------  1 root root 64 Oct  9 11:08 7 -> socket:[52975560]
lrwx------  1 root root 64 Oct  9 11:08 8 -> socket:[52975561]
lrwx------  1 root root 64 Oct  9 11:08 9 -> socket:[52975563]
[root at tupian_web logs]# ../sbin/nginx -V
nginx version: nginx/0.7.62
built by gcc 3.4.6 20060404 (Red Hat 3.4.6-8)
configure arguments:

After kill a USR1 signal to nginx master process, it keeps opening
error.log file and error.log.1 file. Why?

-- 
Ren Xiaolei





More information about the nginx mailing list