Linux常用

时间:2014-05-08 16:41:18   收藏:0   阅读:403

使用shell判断系统时区

if [[ ! `grep -a CST-8 /etc/localtime` ]]; then
    rm -rf /etc/localtime
    ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
fi

Nginx日志切割脚本

#!/bin/bash  
logs_path="/alidata/server/log/nginx/"   
mv ${logs_path}access.log ${logs_path}access_$(date -d "yesterday" +"%Y%m%d").log   
kill -USR1 `cat /alidata/server/nginx/logs/nginx.pid`
添加权限后加入crontab中:  
chmod +x /alidata/server/nginx/sbin/split_nginx_log.sh   
crontab -e   
0 1 * * * /alidata/server/nginx/sbin/split_nginx_log.sh


本文出自 “从心开始” 博客,请务必保留此出处http://fuquanjun.blog.51cto.com/5820068/1408289

Linux常用,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!