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
server { | |
listen 8080; | |
server_name test.com; | |
index index.html index.htm index.php; | |
root /home/wwwroot/test; | |
location /test2 { | |
auth_basic "pd"; | |
auth_basic_user_file /usr/local/nginx/conf/vhost/pd.passwd; | |
allow 114.112.113.111; |
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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
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 | |
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-x64.tar.gz | |
tar xzf node-v0.10.28-linux-x64.tar.gz | |
mv node-v0.10.28-linux-x64 /usr/local/ | |
echo "PATH=$PATH:/usr/local/node-v0.10.28-linux-x64/bin" >> /etc/profile | |
echo "export PATH" >> /etc/profile | |
source /etc/profile | |
cp /usr/local/node-v0.10.28-linux-x64/bin/node /usr/bin | |
cp /usr/local/node-v0.10.28-linux-x64/bin/npm /usr/bin |
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 | |
NOW=$(date +"%Y.%m.%d") | |
cd /tmp | |
tar zcvf /backup/$NOW-row.tar.gz row.log | |
:>row.log | |
#find ${BACKUP_DST} -ctime +30 | xargs rm -rf |
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 | |
######################################### | |
#Function: add a new swap partition | |
#Usage: bash add_swap.sh | |
#Author: Customer service department | |
#Company: Alibaba Cloud Computing | |
#Version: 2.1 | |
######################################### | |
check_os_release() |
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 | |
#Denyhosts SHELL SCRIPT | |
cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"=" $1;}' >/home/sh/Denyhosts.txt | |
DEFINE="10" | |
for i in `cat /home/sh/Denyhosts.txt` | |
do | |
IP=`echo $i|awk -F= '{print $1}'` | |
NUM=`echo $i|awk -F= '{print $2}'` | |
if [ $NUM -gt $DEFINE ] |
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
restrict default kod nomodify notrap nopeer noquery | |
restrict -6 default kod nomodify notrap nopeer noquery | |
# 允许本地所有操作 | |
restrict 127.0.0.1 | |
restrict -6 ::1 | |
# 允许的局域网络段或单独ip | |
#restrict 127.0.0.1 | |
#restrict 192.168.10.2 # 指定某台机器时间同步 |
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 | |
mysql_status=`netstat -nl | awk 'NR>2{if ($4 ~ /.*:3306/) {print "Yes";exit 0}}'` | |
PortNum=`netstat -lnt|grep 3306|wc -l` | |
if [ "$mysql_status" == "Yes" ];then | |
slave_status=`mysql -uroot -p123456 -e"show slave status\G" | grep "Running" | awk '{if ($2 != "Yes") {print "No";exit 1}}'` | |
if [ "$slave_status" == "No" ];then | |
echo "slave is not working!" | |
[ ! -f "/tmp/slave" ] && echo "Slave is not working!" | mail -s "Warn!MySQL Slave is not working" monitor@test.me |
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 | |
DROPBOX_USER="xxx@xxx.com" //Dropbox的账号 | |
DROPBOX_PASS="12345678" //Dropbox的密码 | |
DROPBOX_DIR="/backups" //Dropbox中的文件夹名称 | |
BACKUP_SRC="/home/wwwroot /data" //需要备份的文件夹路径,可以同时指定多个中间用空格隔开 | |
BACKUP_DST="/home/backup" //用来存放备份的文件夹路径 | |
MYSQL_SERVER="127.0.0.1" //连接本地MySQL | |
MYSQL_USER="root" //本地MySQL的用户 | |
MYSQL_PASS="12345678" //本地MySQL的密码 | |
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 | |
############################## | |
# dnspodsh v0.3 | |
# 基于dnspod api构架的bash ddns客户端 | |
# 作者:zrong(zengrong.net) | |
# 详细介绍:http://zengrong.net/post/1524.htm | |
# 创建日期:2012-02-13 | |
# 更新日期:2012-03-11 | |
############################## |
OlderNewer