【shell】日志切割

# nginx日志切割
0 3 1 * * /usr/bin/sh /datas/soft/shell/mv_nginx_log.sh
 
# cat /datas/soft/shell/mv_nginx_log.sh
#!/bin/bash
rm -rf /datas/logs/nginx/bak_*;
mkdir /datas/logs/nginx/bak_`date +%Y%m%d`;
mv /datas/logs/nginx/*.log /datas/logs/nginx/bak_`date +%Y%m%d`;
systemctl reload openresty;

  

 

posted @ 2020-08-27 11:18  蓝色星辰1993  阅读(136)  评论(0编辑  收藏  举报