#!/bin/bash

#切分点击监测日志

log_path="/home/shenzhiming/nginx/logs/dct"
log="clk.trace.log"
log_back_path="/home/shenzhiming/backup/clk"
nginx_pid="/home/shenzhiming/nginx/logs/nginx.pid"

hr=$(date -d "-1 hours" +%Y%m%d%H)

rotate_log="/home/shenzhiming/nginx/rotate_shells/rotate.log"
time=$(date "+%Y-%m-%d %H:%M:%S")

if [ -s "${log_path}/${log}" ];then
	mv "${log_path}/${log}" "${log_back_path}/${log}.${hr}"
	kill -USR1 $(cat ${nginx_pid})
	echo "$time 日志切分完成" >> $rotate_log
else
	echo "$time 日志无数据不进行操作" >> $rotate_log
fi

