使用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
时间: 2024-10-12 07:40:53