linux經常使用腳本

nginx日誌分割腳本php

/shell/nginx-log-split.shnginx

#!/bin/bash
base_path='/home/wwwlogs'
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
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
 shell

每5s執行腳本bash

/shell/execution-per-5s.sh日誌

#!/bin/bash
step=5 #間隔的秒數,不能大於60
for (( i = 0; i < 60; i=(i+step))); do
    $(php '/home/wwwroot/default/running/Public/crontab.php')
    sleep $step
done
exit 0
 crontab

相關文章
相關標籤/搜索