cutlog.sh

  

#!/bin/sh
source /etc/profile  

D=$(date "+%Y%m%d%H%M%S") 
mv "/usr/local/Cellar/nginx/1.10.3/logs/access.log" "/usr/local/Cellar/nginx/1.10.3/logs/${D}.log"
touch "/usr/local/Cellar/nginx/1.10.3/logs/access.log"
[ ! -f /usr/local/Cellar/nginx/1.10.3/logs/nginx.pid ] || kill -USR1 $(cat /usr/local/Cellar/nginx/1.10.3/logs/nginx.pid)

mv 后面的路径一定要加 "   "   

 

crontab -e

   * * * * * /usr/local/Cellar/nginx/1.10.3/logs/nginx_log.sh

相关文章:

  • 2022-02-23
  • 2021-11-29
  • 2021-12-18
  • 2021-10-03
  • 2021-07-15
猜你喜欢
  • 2021-05-21
  • 2021-09-17
  • 2021-12-24
  • 2021-08-12
  • 2021-12-19
  • 2021-08-21
相关资源
相似解决方案