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
#!/bin/bash | |
iptables_ip(){ | |
FILE=$1 | |
egrep -iv "Baiduspider|bingbot|360Spider|JianKongBao|Ezooms|msnbot|Safari|AhrefsBot|Firefox|TurnitinBot|bot|AppleWebKit" $FILE|awk '{print $1}' |sort -n|uniq -c|sort -nr|awk '{if ($1>50) print $1" "$2}' >.tmp_ip | |
if [ -s .tmp_ip ] | |
then | |
while read line | |
do |
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
#!/bin/bash | |
cat list |while read line | |
do | |
echo ===============$line | |
TARGE_IP=`echo $line|awk '{print $3}'` | |
TARGE_PORT=`echo $line|awk '{print $4}'` | |
ssh -p $TARGE_PORT $TARGE_IP "ps axu|grep webserver" < /dev/null |
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
RewriteEngine On | |
RewriteCond %{HTTPS} =off | |
RewriteCond %{REQUEST_URI} !^\/page1\/ | |
RewriteCond %{REQUEST_URI} !^\/page2\/ | |
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301] | |
RewriteCond %{HTTPS} =on | |
RewriteCond %{REQUEST_URI} \/page1\/ [OR] | |
RewriteCond %{REQUEST_URI} \/page2\/ |
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
一、下载并编译mod_rpaf模块到apache | |
二、启动将以下配置添加到httpd.conf | |
LoadModule rpaf_module modules/mod_rpaf-2.0.so | |
RPAFenable On | |
RPAFsethostname On | |
RPAFproxy_ips 10.130.x.x 10.130.x.x 10.130.x.x 10.130.x.x 10.130.x.x 10.130.x.x ###前端IP | |
RPAFheader NS-Client-IP | |
三、重启apache,查看apache日志 |
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
1. 压缩参数 | |
curl --compressed -I " http://xx.x.x.x./xxx/" | |
##nginx 添加jason压缩 | |
gzip_types text/plain application/x-javascript text/css text/xml application/xml application/xml+rss text/javascript image/x-icon image/x-ms-bmp image/g application/json | |
##tomcat 添加jason压缩 | |
compression="on" | |
compressionMinSize="2048" | |
noCompressionUserAgents="gozilla, traviata" | |
compressableMimeType="application/json,application/xml,text/html,text/xml" |
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
如何利用多核CPU来加速你的Linux命令 — awk, sed, bzip2, grep, wc等 | |
你是否曾经有过要计算一个非常大的数据(几百GB)的需求?或在里面搜索,或其它操作——一些无法并行的操作。数据专家们,我是在对你们说。你可能有一个4核或更多核的CPU,但我们合适的工具,例如 grep, bzip2, wc, awk, sed等等,都是单线程的,只能使用一个CPU内核。 | |
借用卡通人物Cartman的话,“如何我能使用这些内核”? | |
要想让Linux命令使用所有的CPU内核,我们需要用到GNU Parallel命令,它让我们所有的CPU内核在单机内做神奇的map-reduce操作,当然,这还要借助很少用到的–pipes 参数(也叫做–spreadstdin)。这样,你的负载就会平均分配到各CPU上,真的。 | |
BZIP2 |
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
#!/bin/bash | |
DATE1=`date +%Y/%m/%d` | |
DATE2=`date +%Y/%m/` | |
PIC_dir="/home/wwwroot/web/" | |
if [ -d ${PIC_dir} ] | |
then | |
cd ${PIC_dir} && find . -name "*.jpg" -exec convert -resize 110x150 {} {} \; | |
fi |
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
#!/bin/bash | |
DATE=$(date +%Y%m%d) | |
/usr/local/webserver/mysql/bin/mysqldump -u root -ppasswd --opt dbname > $DATE | |
tar cfz $DATE.tar.gz $DATE | |
(echo "$DATE DB backup";uuencode $DATE.tar.gz $DATE.tar.gz)|mail -s "${DATE}_pangxiang_DB_backup" [email protected] | |
############################### | |
#也可以使用如下命令进行附件发送,效果也不错 |
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
该功能用户小型个人或公司网站,由于硬件资源有限不能实用数据库进行搭建syslog系统使用。 | |
一、系统环境变量设置 | |
在/etc/profile中添加: | |
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'` | |
TTY_TERMINAL=`who -u am i|awk '{print $2}'` | |
DATE=`date +"%Y%m%d"` | |
if [ "$USER_IP" = "" ] |
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
grant all on *.* to 'root'@'192.168.1.%' identified by '123456'; | |
grant all on *.* to 'root'@'localhost' identified by '123456'; | |
grant all on *.* to 'root'@'127.0.0.1' identified by '123456'; |
OlderNewer