标签:sp on 2014 log bs as nbsp ca br
nginx定时任务完成日志切割
date -d yesterday
date -s ‘2014-11-27 08:55:00‘
clock -w
date -d yesterday +%Y%m%d
--日志脚本
#!/bin/bash
base_path=‘/usr/local/nginx/logs‘
log_path=$(date -d yesterday +"%Y%m")
day=$(date -d yesterday +"%d")
mkdir -p $base_path/$log_path
mv $base_path/access.log $base_path/$log_path/access_$day.log
#echo $base_path/$log_path/access_$day.log
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
man crontab
man crontab(5)
crontab -e
分 时 日 月 周
*/1 * * * * sh /data/runlog.sh
标签:sp on 2014 log bs as nbsp ca br
原文地址:http://my.oschina.net/u/993551/blog/349591