网站排障分析常用的命令 系统连接状态篇: 1.查看TCP连接状态 netstat -nat |awk ‘{print $6}‘|sort|uniq -c|sort -rn? netstat -n | awk ‘/^tcp/ {++S[$NF]};END {for(a in S) print a, S[a]}‘ 或 netstat -n |...
分类:
Web程序 时间:
2015-09-15 16:48:39
阅读次数:
185
#!/bin/bash#Remotemonitoring.Ifthenetworkisbroken,emailme~ping-c10www.baidu.com>33.logwhile["1"="1"]dot=$(awk‘{print$1}‘33.log)if[!-z$($t)];thenecho""sleep30elsebreak;fidoneecho"DiaoXianLe"|mail-s"down"abc@139.com
分类:
其他好文 时间:
2015-09-15 14:51:12
阅读次数:
122
使用 % 将字典中的value嵌入到字符串中对应的key值中dd = {"a":1,"b":2,"c":3}txt = "this is a test : a is %(a)s, b is %(b)s, c is %(c)s "print txt % dd结果为:this is a test : a...
分类:
编程语言 时间:
2015-09-15 14:20:53
阅读次数:
151
if exists(select * from test.dbo.test1 where a='1')beginprint('exists ')endelse begin print('no exists ') endgo
分类:
数据库 时间:
2015-09-15 12:58:23
阅读次数:
145
今天在写一个脚本时需要定义一个全局的时间变量,但是在函数中修改后一直不能更新,发现是因为函数是有自己的namespacelast_send_time = 0def test(): last_send_time = 2print last_send_time#will print 0#to ch...
分类:
编程语言 时间:
2015-09-15 12:53:32
阅读次数:
209
在cmd命令行下输入:netstat -r 或者 route print 就可以查看本机的路由信息了,如图:路由表中的每一个路由项具有五个属性,在此我将它们分为四个部分:1、网络地址(Network Destination)、网络掩码(Netmask):网络地址和网络掩码相与的结果用于定义本地计算机...
5-8Geometryimport mathdef sqcube(): s = float(raw_input('enter length of one side: ')) print 'the area is:', s ** 2., '(units squared)' print 'the ...
分类:
编程语言 时间:
2015-09-15 12:28:51
阅读次数:
141
在寻找k_word时,为了去打末尾的换行符,使用chomp;但在windows下创建的的文件,读取一行,如一行为 weather 把它赋值为$str,然后print length($str),得到8;chomp $str; print length($str) 得到7同样在linux创建同样的文件....
分类:
其他好文 时间:
2015-09-15 12:25:37
阅读次数:
111
#coding:utf-8L = ['a','b','c']S = []for i in L: tmp = str(i).decode('utf-8') S.append(tmp)print S
分类:
其他好文 时间:
2015-09-15 12:24:08
阅读次数:
108
第一层:纯C环境下,把C函数注册进Lua环境a.lua 文件print(foo(99))a.c 文件#include #include #include int foo(lua_State *L){ int n = lua_tonumber(L, 1); lua_pushnumber(L, n .....
分类:
编程语言 时间:
2015-09-14 22:28:44
阅读次数:
290