欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來到夢飛科技

系統(tǒng)配置

當(dāng)前優(yōu)惠活動:

利用cronolog按每小時切割nginx日志的設(shè)置方法

1.mkfifo /map/logs/nginx/wireless/access.log

 nohup cat /map/app/nginx-1.2.2/logs/error.log | /map/app/tools/cronolog-1.7.0/sbin/cronolog  /map/logs/nginx/wireless/error/%Y/%m/%d/%H.log &

 nohup cat /map/logs/nginx/wireless/access.log | /map/app/tools/cronolog-1.7.0/sbin/cronolog  /map/logs/nginx/wireless/%Y/%m/%d/%H.log &

注意:在啟動nginx前必須先啟動cronolog,否則無法啟動
2.把cronolog增加到nginx啟動腳本中
腳本內(nèi)容如下:
#!/bin/sh
#
# Comments to support chkconfig
#
# chkconfig: 2345 77 77
# Description: Startup script for nginx webserver
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx daemon"
NAME=nginx
DAEMON=/map/app/nginx/sbin/$NAME
CONFIGFILE=/map/app/nginx/conf/nginx.conf
PIDFILE=/map/app/nginx/logs/$NAME.pid
SERVICENAME=/etc/init.d/nginxd-map
cronolog=/map/app/tools/cronolog-1.7.0/sbin/cronolog
ErrorLog=/map/app/nginx-1.0.6/logs/error.log
AccessLog=/map/logs/nginx/wireless/access.log
##紅色部分是新增加的,檢測文件是否是pipe類型,啟動cronolog,殺掉cronolog,很簡單,但是能夠?qū)崿F(xiàn)功能
d_mkfifo(){
[ ! -p $ErrorLog ] || [ ! -p $AccessLog ]  &&  /bin/rm $ErrorLog $AccessLog  && mkfifo $ErrorLog $AccessLog
}
cronolog_start()
{
#ps -ef|grep wireless|grep -v grep |awk '{print $2}'|xargs kill -9
nohup cat /map/app/nginx-1.0.6/logs/error.log | $cronolog  /map/logs/nginx/wireless/error/%Y/%m/%d/%H.log &
nohup cat /map/logs/nginx/wireless/access.log | $cronolog  /map/logs/nginx/wireless/%Y/%m/%d/%H.log &
}
cronolog_kill()
{
ps -ef|grep wireless|grep -v grep |awk '{print $2}'|xargs kill -9
}
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
d_start() {
d_mkfifo
cronolog_start
  $DAEMON -c $CONFIGFILE || echo -n " already running"
}
d_stop() {
#  kill -QUIT `cat $PIDFILE` || echo -n " not running"
cronolog_kill
killall nginx || echo -n " not running"
}
d_reload() {
  kill -HUP `cat $PIDFILE` || echo -n " can't reload"
}

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        d_start
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME"
        d_stop
        echo "."
        ;;
  reload)
        echo -n "Reloading $DESC configuration..."
        d_reload
        echo "reloaded."
        ;;
  status)
        pgrep -x $NAME > /dev/null && echo $NAME (pid `pgrep $NAME`) is running...  || echo "$NAME is stoped."
        ;;
  test|-t)
        $DAEMON -t
        ;;
  restart)
        echo -n "Restarting $DESC: $NAME"
        d_stop
        sleep 2
        d_start
        echo "...done!"
        ;;
  *)
          echo "Usage: $SERVICENAME {start|stop|restart|reload|status|check}"
          exit 3
        ;;
esac
exit 0

夢飛科技 - 全球數(shù)據(jù)中心基礎(chǔ)服務(wù)領(lǐng)先供應(yīng)商

Copyright © 2003-2019 MFISP.COM. 國外服務(wù)器租用 IDC公司 版權(quán)所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 武夷山市| 呈贡县| 桓台县| 牙克石市| 凤山市| 乐业县| 合肥市| 喜德县| 永仁县| 分宜县| 镇平县| 米泉市| 长岭县| 长阳| 得荣县| 高雄县| 澄城县| 怀宁县| 胶州市| 榆林市| 光泽县| 杂多县| 陵川县| 西峡县| 岳西县| 前郭尔| 凌源市| 海淀区| 亚东县| 类乌齐县| 凌源市| 高邮市| 巴林左旗| 麻江县| 会同县| 方正县| 滦平县| 六枝特区| 洛南县| 宜君县| 中卫市|