#!/bin/bashcmd="ls -lt | grep ^d | awk 'NR==1 {print $9}'"$cmd这是一个获取文件夹名字的脚本,但是却提示:ls: cannot access |: no such file or directoryls: cannot access gre...
分类:
系统相关 时间:
2015-10-19 17:03:35
阅读次数:
188
几个符号意义: R:相关文档集 NR:不相关文档集 q:用户查询 dj:文档j1/0风险情况 PRP(probability ranking principle):概率排序原理,利用概率模型来估计每篇文档和需求相关概率,然后对结果进行排序。 贝叶斯最优决策原理,基于最小损失风险作...
分类:
其他好文 时间:
2015-10-18 18:34:01
阅读次数:
420
从固定格式中取出IP所在的class,并列出例:classA{192.168.1.1192.168.2.1192.168.3.1192.168.169.69}classB{192.168.1.1192.168.169.69}sed-nr‘/\{/{:1;N;/\}/!b1;/192.168.169.69/s#^([^{]+).*#\1#p}‘fileawk-vRS=‘class*.‘‘/192.168.169.69/{prints}{s=RT}‘filesed-nr‘/cla..
分类:
其他好文 时间:
2015-10-16 15:23:40
阅读次数:
169
wc -l filenamegrep -c "" filenamesed-n'$='filenameawk'END{print NR}'filename但是这几种方法的效率却是不同的。通过以下测试:time wc -l filename 平均:0.237667stime grep -c "" fil...
分类:
系统相关 时间:
2015-10-16 11:21:59
阅读次数:
215
在开发运维的时候我们常常会遇到类似“Socket/File:Can’topensomanyfiles”,“无法打开更多进程”,或是coredump过大等问题,这些都可以设置资源限制来解决。今天在教某位客户设置最大文件数方法时,搜索网上的方法时发现各家说法并不一致,便写了这篇文档。通常对linux某个..
分类:
系统相关 时间:
2015-10-15 18:48:29
阅读次数:
230
#!/bin/bash#硬盘是否损坏(echo),i节点,硬盘空间使用率。#Iftheharddriveisdamaged(ECHO),theI-node,diskspaceusage.CD=`df-l|awk‘NR==3{print$4}‘|awk‘BEGIN{FIELDWIDTHS="21"}‘‘{print$1}‘`I=`df-i|awk‘NR==3{print$3}‘`DF=`df-l|awk‘NR==3{print$3}‘`DFG=`expr$DF/10485..
分类:
其他好文 时间:
2015-10-12 02:04:24
阅读次数:
184
#!/bin/bashwhiletruedoRX=`ifconfig|awk‘NR==7{print$2}‘|cut-d":"-f2`TX=`ifconfig|awk‘NR==7{print$6}‘|cut-d":"-f2`ZX=`expr$RX+$TX`sleep60#foriin`seq120-11`#do#echo-n-e"\b$i"#sleep1#done#echo-n-e"\b"RX1=`ifconfig|awk‘NR==7{print$2}‘|cut-d":"-f2`TX1=`ifconfig|a..
分类:
其他好文 时间:
2015-10-12 02:04:02
阅读次数:
229
#!/bin/bashCD=`df-l|awk‘NR==3{print$4}‘|awk‘BEGIN{FIELDWIDTHS="21"}‘‘{print$1}‘`if[$CD-ge20];thenecho"硬盘空间已满,不能进行备份"|mutt-s"备份报警,请及时更换硬盘"lrtao2010@yeah.net&&exit1filogrotate-f/etc/logrotate.conftarzcf/opt/backup/`date+%Y%m%d..
分类:
系统相关 时间:
2015-10-11 20:03:55
阅读次数:
207
1、查看Web服务器(NginxApache)的并发请求数及其TCP连接状态:netstat-n|awk‘/^tcp/{++S[$NF]}END{for(ainS)printa,
S[a]}‘netstat-n|grep^tcp|awk‘{print$NF}‘|sort
-nr|uniq-c或者:netstat-n|awk‘/^tcp/{++state[$NF]}END{for(keyinstate)
printkey,"t",state[key]}‘..
分类:
Web程序 时间:
2015-09-23 17:15:36
阅读次数:
173
#1.Mailpartialconfiguration,set/etc/mail.rc
#2.Belowisthemainconfiguration
cat>>/etc/profile<<Share
#Variables
LAST_USER=`last-n2|awk‘NR==2{print$1}‘`
LOG_FILE_PATH="/tmp/Shared_Operation"
LAST_FILE_LOG=`ls-tl${LOG_FILE_PATH}/${LAST_USER}|awk-F‘..
分类:
其他好文 时间:
2015-09-21 12:33:31
阅读次数:
161