秀米云香港服务器

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 &

序列号 CPU RAM HDD 带宽 售价(美元) 免费试用
香港服务器1 E5-2620 32G 1T HDD 50M/无限流量 $196.00 立即申请
香港服务器2 E5-2650 32G 1T HDD 50M/无限流量 $256.00 立即申请
香港服务器3 E5-2680 32G 1T HDD 50M/无限流量 $316.00 立即申请
香港服务器4 E5-2690 32G 1T HDD 50M/无限流量 $336.00 立即申请
香港服务器5 E5-2697 32G 1T HDD 50M/无限流量 $376.00 立即申请
香港服务器6 E5-2620*2 32G 1T HDD 50M/无限流量 $376.00 立即申请
香港服务器7 E5-2650*2 32G 1T HDD 50M/无限流量 $436.00 立即申请
香港服务器8 E5-2680*2 32G 1T HDD 50M/无限流量 $476.00 立即申请
香港服务器9 E5-2690*2 32G 1T HDD 50M/无限流量 $556.00 立即申请
香港服务器10 E5-2697*2 32G 1T HDD 50M/无限流量 $596.00 立即申请
香港服务器11 E5-2680v4*2 32G 1T HDD 50M/无限流量 $696.00 立即申请
香港服务器12 E5-2698v4*2 32G 1T HDD 50M/无限流量 $796.00 立即申请

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启动剧本中剧本内容如下:#!/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/binDESC="nginx daemon"NAME=nginxDAEMON=/map/app/nginx/sbin/$NAMECONFIGFILE=/map/app/nginx/conf/nginx.confPIDFILE=/map/app/nginx/logs/$NAME.pidSERVICENAME=/etc/init.d/nginxd-mapcronolog=/map/app/tools/cronolog-1.7.0/sbin/cronologErrorLog=/map/app/nginx-1.0.6/logs/error.logAccessLog=/map/logs/nginx/wireless/access.log##赤色部门是新增加的,,检测文件是否是pipe范例,启动cronolog,杀掉cronolog,很简朴,可是可以或许实现成果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 -9nohup 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 0d_start() {d_mkfifocronolog_start $DAEMON -c $CONFIGFILE || echo -n " already running"}d_stop() {# kill -QUIT `cat $PIDFILE` || echo -n " not running"cronolog_killkillall 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 ;;esacexit 0

标题:操作cronolog按每小时切割nginx日志的配置要领

地址: https://www.yunhk.xyz/26081.html