rotate.logs
上传用户:ladybrid91
上传日期:2007-01-04
资源大小:287k
文件大小:2k
- #!/bin/csh
- #
- # This script can be used to rotate the Phttpd log files
- #
- umask 022
- set LOGROOT="/var/log/phttpd"
- if (-x /opt/gnu/bin/gzip) then
- set COMPRESS="/opt/gnu/bin/gzip -9"
- set COMPREXT="gz"
- else if (-x /bin/compress) then
- set COMPRESS="/bin/compress"
- set COMPREXT="Z"
- endif
- cd $LOGROOT
-
- if (-f requests.9.$COMPREXT) /bin/rm -f requests.9.$COMPREXT
- if (-f requests.8.$COMPREXT) /bin/mv requests.8.$COMPREXT requests.9.$COMPREXT
- if (-f requests.7.$COMPREXT) /bin/mv requests.7.$COMPREXT requests.8.$COMPREXT
- if (-f requests.6.$COMPREXT) /bin/mv requests.6.$COMPREXT requests.7.$COMPREXT
- if (-f requests.5.$COMPREXT) /bin/mv requests.5.$COMPREXT requests.6.$COMPREXT
- if (-f requests.4.$COMPREXT) /bin/mv requests.4.$COMPREXT requests.5.$COMPREXT
- if (-f requests.3.$COMPREXT) /bin/mv requests.3.$COMPREXT requests.4.$COMPREXT
- if (-f requests.2.$COMPREXT) /bin/mv requests.2.$COMPREXT requests.3.$COMPREXT
- if (-f requests.1.$COMPREXT) /bin/mv requests.1.$COMPREXT requests.2.$COMPREXT
- if (-f stderr.9.$COMPREXT) /bin/rm -f stderr.9.$COMPREXT
- if (-f stderr.8.$COMPREXT) /bin/mv stderr.8.$COMPREXT stderr.9.$COMPREXT
- if (-f stderr.7.$COMPREXT) /bin/mv stderr.7.$COMPREXT stderr.8.$COMPREXT
- if (-f stderr.6.$COMPREXT) /bin/mv stderr.6.$COMPREXT stderr.7.$COMPREXT
- if (-f stderr.5.$COMPREXT) /bin/mv stderr.5.$COMPREXT stderr.6.$COMPREXT
- if (-f stderr.4.$COMPREXT) /bin/mv stderr.4.$COMPREXT stderr.5.$COMPREXT
- if (-f stderr.3.$COMPREXT) /bin/mv stderr.3.$COMPREXT stderr.4.$COMPREXT
- if (-f stderr.2.$COMPREXT) /bin/mv stderr.2.$COMPREXT stderr.3.$COMPREXT
- if (-f stderr.1.$COMPREXT) /bin/mv stderr.1.$COMPREXT stderr.2.$COMPREXT
- if (-f requests) then
- /bin/rm -f .requests.tmp
- /bin/mv requests .requests.tmp
- endif
- if (-f stderr) then
- /bin/rm -f .stderr.tmp
- /bin/mv stderr .stderr.tmp
- endif
- /bin/kill -HUP `/bin/cat pid`
- if (-f .requests.tmp) then
- /opt/www/bin/logcvt-ip2n .requests.tmp requests.1
- /bin/rm -f .requests.tmp requests.1.$COMPREXT
- $COMPRESS requests.1
- endif
- if (-f .stderr.tmp) then
- $COMPRESS <.stderr.tmp >stderr.1.$COMPREXT
- endif
- exit 0