Skip to content

Commit 7090569

Browse files
committed
update
1 parent b1d40bc commit 7090569

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

expect/expect_scp.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/expect -f
2+
set ip [lindex $argv 0]
3+
set timeout 1200
4+
spawn /usr/bin/scp -r 192.168.10.10:/data/www/ /data/
5+
expect {
6+
"(yes/no)?" {send "yes\r"}
7+
"*password:" {send "www.aqzt.com\r"}
8+
}
9+
expect "password:"
10+
send "123456\r"

shell/find/find.sh

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ find /data/nginx/log/ -ctime +5 -exec rm -f {} \;
2121
find /data/logs -ctime +5 -exec rm -f {} \;
2222
find /data/logs -name "localhost_access_log*.txt" -type f -mtime +5 -print -exec rm -f {} \;
2323

24+
25+
##删除目录下所有的 .svn 隐藏子目录
26+
find . -name .svn -print0 | xargs -0 rm -r -f
27+
find /data/file1 -name .svn -print0 | xargs -0 rm -r -f
28+
find /data/file1 -name .git -print0 | xargs -0 rm -r -f
29+
find . -name .svn -print0 | xargs -0 rm -r -f
30+
find . -name .git -print0 | xargs -0 rm -r -f
31+
32+
2433
##找出 n 天前的文件
2534
find /temp/ -type f -mtime +n -print
2635

shell/sed/sed.sh

+16-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,19 @@ sed -i "s/text_to_replace/replacement/g" `find . -type f -name <filename>`
2424
sed -i "s/10.0.0.75/10.0.0.76/g" `find . -type f -name "*.properties"`
2525
sed -i "s/10.0.0.18/10.0.0.17/g" `find . -type f -name "*.properties"`
2626
sed -i "s/10.0.0.16/10.0.0.17/g" `find . -type f -name "*.php"`
27-
sed -i "s/d12/111222/g" `find . -type f -name "*.properties"`
27+
sed -i "s/d12/111222/g" `find . -type f -name "*.properties"`
28+
29+
30+
#sed删除文件倒数10行
31+
#把文件倒序
32+
sed -i '1!G;$!h;$!d' filename
33+
#删除10行
34+
sed -i '1,10d' filename
35+
#把文件倒序回来
36+
sed -i '1!G;$!h;$!d' filename
37+
38+
nl file | tail -n 10 | awk 'NR == 1 '{print $1}'
39+
40+
awk 'BEGIN{CMD="wc -l file";CMD|getline i}NR<=(i-10)' file
41+
sed -n ':a;1,10!{P;N;D;};N;ba' file
42+

snmp/snmpd.conf_centos6.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
##robert yu
66
##centos 6
77

8-
8+
yum install -y gcc net-snmp
99

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

23+
/sbin/chkconfig snmpd on
2324
/sbin/service snmpd restart

0 commit comments

Comments
 (0)