#!/bin/bash
#
if[$#-lt1];then
echo"AadminuserARG..."
exit8
fi
if[$1=="add"];then
forIin{1..10};do
ifiduser$I&>/dev/null;then
echo"useruser$Iexist"
else
useradduser$I
echo"user$I"|passwd--stdinuser$I&>/dev/null
echo"user$Ifinished"
fi
done
elif..
分类:
其他好文 时间:
2015-04-15 23:48:23
阅读次数:
232
curl的用法记录
hostname=www.qq.com
1)得到httpstatus
[root@svr200-22~]#curl-o/dev/null-s-w%{http_code}${hostname}
200
2)得到详细的httpheaders信息
[root@svr200-22~]#curl-o/dev/null-vhttp://${hostname}
*Abouttoconnect()towww.qq.comport80(#0)
*Trying14.17...
分类:
Web程序 时间:
2015-04-15 15:00:04
阅读次数:
145
1,完整的监控脚本如下#!/bin/bash#web_status_code=`curl -o /dev/null -s -w "http_code:%{http_code}" http://yjszs.nudt.edu.cn/`#1,web_status_code=`curl -o /dev/nu...
分类:
数据库 时间:
2015-04-13 14:12:33
阅读次数:
157
首先备份默认源:sudo cp /etc/apt/sources.list /etc/apt/sources.list.old清空默认源:sudo cat /dev/null > /etc/apt/sources.list添加源:sudo vim /etc/apt/sources.list推荐源:#...
分类:
系统相关 时间:
2015-04-13 12:14:14
阅读次数:
242
1,监控给定web站点的状态--站点请求返回代码,下载整个web站点页面文本到-o 指定的文本curl -o /dev/null -s-silent -w--wirte-out "%{http_code}" "http://baidu.com";2,开启gizp3,curl监控网页响应时间curl ...
分类:
Web程序 时间:
2015-04-11 13:12:48
阅读次数:
163
实现的方法是输出重定向,以下实现将所有无价值的输出重定向到 无返回的黑洞中。$ make > /dev/null或者,编译内核时:$ make uImage > /dev/null
分类:
系统相关 时间:
2015-04-07 21:35:09
阅读次数:
174
#!/bin/bash
echo-e"PID\t\tSwap\t\tProc_Name"
forpidin`ls-l/proc|grep^d|awk‘{print$9}‘|egrep-v[a-z]+`
do
#进程id是1为祖进程
if[$pid-eq1];thencontinue;fi#Donotcheckinitprocess
#判断改进程是否占用了swap
grep-q"Swap"/proc/$pid/smaps2>/dev/null
if[$?-eq0];t..
分类:
系统相关 时间:
2015-04-07 20:09:27
阅读次数:
346
一、dd命令详解:官方解释:convertandcopyafile---转换并复制文件dd是Linux/UNIX下的一个非常有用的命令,作用是用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换语法:dd[OPERAND]...ddOPTION参数:if=FILEreadfromFILEinsteadofstdin源文件,用于指定数据流来源of..
分类:
系统相关 时间:
2015-04-07 07:19:16
阅读次数:
208
exit1即可在脚本中途结束执行例:[root@localhostscript]#catusertest.sh#!/bin/bash#TESTUSER=hbaseif!grep"^$TESTUSER"/etc/passwd&>/dev/null;thenecho"Notfinduser:$TESTUSER"exit1fiUSERUID=`grep"^$TESTUSER"/etc/passwd|cut-d:-f3`USERGROUPID=`grep"^$TESTUSER"..
分类:
系统相关 时间:
2015-04-02 16:45:42
阅读次数:
175
mysql3306端口down
#!/bin/bash
######mysqlmonitor##
while:
do
sleep80
/usr/bin/nclocalhost3306-w2&>/dev/null
h=0
if[-ne0];then
/etc/init.d/mysqlstart
fi
done
#!/bin/bash
######mysqlmonitor##
while:
do
sleep80
/usr/bin/nclocalhost3306-w2&>/dev..
分类:
数据库 时间:
2015-03-28 18:55:21
阅读次数:
329