Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ppabc committed Aug 30, 2016
1 parent b1d40bc commit 7090569
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
10 changes: 10 additions & 0 deletions expect/expect_scp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/expect -f
set ip [lindex $argv 0]
set timeout 1200
spawn /usr/bin/scp -r 192.168.10.10:/data/www/ /data/
expect {
"(yes/no)?" {send "yes\r"}
"*password:" {send "www.aqzt.com\r"}
}
expect "password:"
send "123456\r"
9 changes: 9 additions & 0 deletions shell/find/find.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ find /data/nginx/log/ -ctime +5 -exec rm -f {} \;
find /data/logs -ctime +5 -exec rm -f {} \;
find /data/logs -name "localhost_access_log*.txt" -type f -mtime +5 -print -exec rm -f {} \;


##删除目录下所有的 .svn 隐藏子目录
find . -name .svn -print0 | xargs -0 rm -r -f
find /data/file1 -name .svn -print0 | xargs -0 rm -r -f
find /data/file1 -name .git -print0 | xargs -0 rm -r -f
find . -name .svn -print0 | xargs -0 rm -r -f
find . -name .git -print0 | xargs -0 rm -r -f


##找出 n 天前的文件
find /temp/ -type f -mtime +n -print

Expand Down
17 changes: 16 additions & 1 deletion shell/sed/sed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,19 @@ sed -i "s/text_to_replace/replacement/g" `find . -type f -name <filename>`
sed -i "s/10.0.0.75/10.0.0.76/g" `find . -type f -name "*.properties"`
sed -i "s/10.0.0.18/10.0.0.17/g" `find . -type f -name "*.properties"`
sed -i "s/10.0.0.16/10.0.0.17/g" `find . -type f -name "*.php"`
sed -i "s/d12/111222/g" `find . -type f -name "*.properties"`
sed -i "s/d12/111222/g" `find . -type f -name "*.properties"`


#sed删除文件倒数10行
#把文件倒序
sed -i '1!G;$!h;$!d' filename
#删除10行
sed -i '1,10d' filename
#把文件倒序回来
sed -i '1!G;$!h;$!d' filename

nl file | tail -n 10 | awk 'NR == 1 '{print $1}'
awk 'BEGIN{CMD="wc -l file";CMD|getline i}NR<=(i-10)' file
sed -n ':a;1,10!{P;N;D;};N;ba' file
3 changes: 2 additions & 1 deletion snmp/snmpd.conf_centos6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
##robert yu
##centos 6


yum install -y gcc net-snmp

cat >/etc/snmp/snmpd.conf<<EOF
com2sec notConfigUser 127.0.0.1 public
Expand All @@ -20,4 +20,5 @@ access notConfigGroup "" any noauth exact all none none
dontLogTCPWrappersConnects yes
EOF

/sbin/chkconfig snmpd on
/sbin/service snmpd restart

0 comments on commit 7090569

Please sign in to comment.