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