forked from aqzt/kjyw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
#初始化 | ||
|
||
LOGS_PATH=/var/log/nginx | ||
|
||
YESTERDAY=$(date -d "yesterday" +%Y%m%d) | ||
|
||
#按天切割日志 | ||
|
||
mv ${LOGS_PATH}/aqzt.com.log ${LOGS_PATH}/aqzt.com_${YESTERDAY}.log | ||
|
||
#向nginx主进程发送USR1信号,重新打开日志文件,否则会继续往mv后的文件写数据的。原因在于:linux系统中,内核是根据文件描述符来找文件的。如果不这样操作导致日志切割失败。 | ||
|
||
kill -USR1 `ps axu | grep "nginx: master process" | grep -v grep | awk '{print $2}'` | ||
|
||
#删除7天前的日志 | ||
|
||
cd ${LOGS_PATH} | ||
|
||
find . -mtime +7 -name "*20[1-9][3-9]*" | xargs rm -f | ||
|
||
#或者 | ||
|
||
#find . -mtime +7 -name "aqzt.com_*" | xargs rm -f | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
## dnsmasq 2017-02-08 | ||
## http://www.aqzt.com | ||
## email: [email protected] | ||
## robert yu | ||
## centos 7 | ||
|
||
yum install dnsmasq -y | ||
cp /etc/resolv.conf /etc/resolv.dnsmasq.conf | ||
cp /etc/hosts /etc/dnsmasq.hosts | ||
echo 'nameserver 127.0.0.1' > /etc/resolv.conf | ||
echo 'resolv-file=/etc/resolv.dnsmasq.conf' >> /etc/dnsmasq.conf | ||
echo 'addn-hosts=/etc/dnsmasq.hosts' >> /etc/dnsmasq.conf | ||
|
||
service dnsmasq restart |