自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(45)
  • 资源 (3)
  • 收藏
  • 关注

原创 python 2 3 win 环境共存

python环境 一会2 一会3 折腾的比较烦,百度搜索自己实践整理了下window python安装python3 -m pip install --upgrade pip --force-reinstall重新安装pipwindows python2,python3环境共存,python2 就装32bit python3装64bitpython-2.7.11.msi  

2016-10-19 11:52:42 751

原创 python 遍历目录

import osdef list_file(path,level=0):    list = os.listdir(path) #列出当前目录的文件    if not list: #判断文件是否为空        return    for file in list:        print(("|" + ' '*4)*level + '|---' + file)

2016-09-22 15:34:48 369

原创 python 3.3 安装paramiko模块

1、最近在学习python,想写个远程登录的小脚本,发现需要用到paramiko模块,网上各种搜各种搞终于搞定,分享一下2、最新版的python 3.5 是找不到匹配的crprycto模块      环境:window7 64     python: 3.3 版本下载地址 https://www.python.org/downloads/       安装完成后要配置环境变量,

2016-03-10 17:13:23 1279

原创 exec 重定向

num=$1exec 3>&1                       #将标准输入定向到FD3 ,这样就不会子在屏幕打印exec 1>execlog.txt         #将标准输入定向到文件日志execlog.txtif [ "$num" -eq 0 ];then        echo "num 1 is 0"   # 该信息在屏幕将不会显示fiexec

2015-01-26 11:06:10 961

原创 linux 隧道设置

Linux隧道配置Server1:Eth0:192.168.100.90 tunl1 172.16.100.90 Server2:Eth0:192.168.100.100 tunl1 172.16.100.100 Server1 server2之间eth0同网段直连,但是tunl1之间无法互访通过配置gre隧道相连接Server1: modeprobe ipip

2014-07-15 15:38:49 1301

原创 TCP 学习记录 (摘自tcp/ip卷一)

TCP的 TIME_WAIT 状态    TCP要求,首先发出 FIN 的一端,在通信双方都完全关闭连接之后,仍然要保持在 TIME_WAIT 状态直至两倍的报文段最大生存时间(MSL)。MSL 的建议值是120秒,也即处于 TIME_WAIT 状态要达到4分钟。当连接处于 TIME_WAIT 状态时,同一连接(即客户I P地址和端口号,以及服务器I P地址和端口号这4个值相同)不能重复打开。

2013-07-05 10:06:51 623

原创 linux snmp客户端配置

linux snmp客户端设置环境 redhat5.5_x64安装yum install -y net-snmp 会安装两个包net-snmp.x86_641:5.3.2.2-9.el5,lm_sensors.x86_64 0:2.10.7-9.el5设置自动启动chkconfig snmpd on启动service snmpd start修改vi /etc/snm

2013-03-10 19:01:24 4313

原创 opentack 删除卷脚本测试,删除卷api

#!/bin/bashURL=http://192.168.0.17:8776/v1/tenantID=e7ffc374e7d844579b5e69ec05a0457atoken=2d527535a281428abea0008718954186volsize=1GetVolumeID (){    curl -X GET -H "X-Auth-Token: $t

2013-03-05 17:51:20 747

原创 openstack 创建快照脚本测试

#!/bin/bashURL=http://192.168.0.17:8774/v2tenantID=e7ffc374e7d844579b5e69ec05a0457atoken=bdd3d382afd342b197c56914ff885c27GetInstanceID (){    curl -X GET -H "X-Auth-Token: $token" ${UR

2013-03-05 17:50:53 1217

原创 opentack 创建卷脚本测试,创建卷api

#!/bin/bashURL=http://192.168.0.17:8776/v1/tenantID=e7ffc374e7d844579b5e69ec05a0457atoken=bdd3d382afd342b197c56914ff885c27volsize=1AddVolumes (){    curl -X POST -H "Content-Type: ap

2013-03-05 17:50:22 565

原创 openstack 创建实例脚本测试,创建实例api

#!/bin/bashURL=http://192.168.0.17:8774/v2/tenantID=e7ffc374e7d844579b5e69ec05a0457atoken=bdd3d382afd342b197c56914ff885c27imageID=f9b75097-0bf4-443b-9f65-922ae40bcc53flavorID=1instan

2013-03-05 17:49:55 1872

原创 openstack swift 测试脚本 上传文件api

#!/bin/bashfilesize=$1count=$2SWIFT_URL=http://192.168.0.21:8080/v1tenatid=e7ffc374e7d844579b5e69ec05a0457acontainer=ggtoken=2ac5b74d2f81497fa57ded599ee62e03x=1sum=0cat /dev/null

2013-03-05 17:49:08 2073

原创 openstack shell脚本 利用curl 删除实例 API

#!/bin/bashURL=http://192.168.0.17:8774/v2tenantID=e7ffc374e7d844579b5e69ec05a0457atoken=24d4eaef30604259be2517419807e190instanceDel ()  删除指定ID的实例{    curl -X DELETE -H "X-Auth-Tok

2013-03-05 17:48:18 1990

原创 swift proxy-server 安装

Swift 安装1 Swift(Proxy+storage)将swift 和keystone分离安装,4个zone用4块硬盘来替代1.1 环境说明机器名    eth0    说明Cloudtest01    192.168.0.17/24    Keystone glance nova-api nova-volumesCloudtest03    192.168.0.21

2013-03-05 17:43:59 5332

原创 redhat lvs piranha

1 piranha lvs负载均衡配置安装piranha #yum install piranha# /sbin/service piranha-gui start# chkconfig piranha-gui on必须在系统中安装Apache HTTP Server通过service 命令终止piranha-gui服务来终止或重启httpd服务配置piranha co

2013-03-05 13:54:27 1403

原创 linux iscsi tgtd的安装学习及问题

Iscsi安装yum install scsi-target-utilsservice tgtd startchkconfig tgtd on修改配置文件/etc/tgt/targets.conf 将sdb磁盘添加为scsi磁盘    direct-store /dev/sdbservice tgtd restart 重启使配置文件生效让任意客户端都可以存取

2013-02-20 14:49:18 18500 2

原创 centos 添加epel源

centos添加epel源,用的实际上是 fedora的库地址http://dl.fedoraproject.org/pub/epel/6/x86_64/下载里面的epel包,包版本会变得rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmrpm --im

2013-02-18 17:43:55 912

原创 利用denyhosts防止ssh暴力破解+脚本防破解

安装条件,判断sshd是否支持tcp_wrappers 需要python一般默认都安装了[root@server01 ~]# ldd /usr/sbin/sshd |greplibwrap*       libwrap.so.0 => /lib64/libwrap.so.0 (0x00007fded7bd6000)下载安装包denyhosts安装包,2.6版本各种版本地址htt

2013-02-18 16:09:55 848

原创 nagios安装配置笔记

Nagios安装概述:Nagios是一个监视系统运行状态和网络信息的监视系统。Nagios能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等。Nagios可运行在Linux/Unix平台之上,同时提供一个可选的基于浏览器的WEB界面以方便系统管理人员查看网络状态,各种系统问题,以及日志等等。Nagios 可以监控的功能有:1、监控网络服务(SMTP、POP3、HTTP

2013-01-28 15:02:35 1109

原创 mysql二进制日志分析

配置的主主复制模式,实际我们只关心主备情况下的二进制日志Mysql日志的一些命令2 常用日志命令SHOW ENGINES 显示mysql发行版的所有可用存储引擎的列表及其状态,有助于查看复制过程中是否在master和slave上存在相同的存储引擎。SHOW BINLOG EVENTS [IN ‘’] [FROM ][LIMIT [,] ]显示被记录到二进制日志的事件。可

2013-01-17 08:45:53 671

原创 keepalive+mysql 主主配置

1.   环境说明:机器名eth0说明server01192.168.100.30/24Mysql、keepaliveserver02192.168.100.31/24Mysql、keepalive 2.   安装mysql去官网下载mys

2013-01-15 09:10:08 1671

原创 gluster安装,镜像卷配置,扩展,故障恢复,nfs挂载

Gluster 安装(镜像) 1.   环境准备机器名eth0说明server01192.168.100.30/24Centos 6.3 64bit ,多准备一块磁盘server02192.168.100.31/24Centos 6.3 64bit,多准备

2013-01-05 14:09:11 7213

原创 python 安装升级

CentOS默认安装2.6 下载python2.7的包# yum install zlibzlib-devel  先安装这个后面安装setuptool有用# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz# tar -zxvf Python-2.7.3.tgz# cd Python-2.7.3

2012-12-22 12:53:24 501

转载 ubuntu下用Pip安装python拓展包

ubuntu下用Pip安装python拓展包今天在windows下学习django的时候创建admin的用户,在python命令模式执行manage.py createsuperuserpython.exe虚拟机崩溃...我也崩溃了,按照教程一步步没错,环境也没问题,在网上找到了一些同样的错误 但貌似没解决方法,建议换到linux环境下..没办法只能将pytho

2012-12-19 17:07:27 2280

原创 grep 多条件搜索

grep -e (条件)-e (条件) 或的关系 例如搜索文本中,包含ac 或者bc的行grep -e ’ac‘ -e ’bc‘

2012-12-18 16:49:24 640

转载 修改网卡名称

CentOS 6.2修改网卡名称 最近在DELL的服务器上安装CentOS6.2,没有注意网卡的名字问题。结果在使用是发现名字已经变了,名字不是eth*,而是em*(具体命名规则这里 http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming   )。网卡名字的变化,导致脚本无法正常执行,现在记录一下修改方法:w

2012-12-14 16:46:27 830

原创 nginx ——redhat5.5 实现负载均衡

nginx负载均衡配置1物理环境192.168.221.129Redhat5.5nginx-0.7.69稳定版192.168.221.130Redhat5.5nginx-0.7.69稳定版2.安装环境两台机器均选装nginx先安装nginx 依赖包yum install -y

2012-12-14 10:50:38 636

原创 ubuntu12.04 安装桌面环境 及vnc配置

最近给ubuntu安装gnome环境搞得一头雾水,还有官方的源不要改动,不然会出现啥找不到依赖之类的问题很头疼,网上搜的apt-get源尽管速度快,但是有些东西找不到,建议新手用不要随意更改源。最简单的安装gnome只需要两条命令apt-get install x-window-system-coreapt-get  install gnome不过会装出gnome的几个版本,什么经

2012-12-13 10:34:28 1267

原创 shell中的指针-变量的间接引用

#!/bin/basha=abcdabcd=1234echo "a = $a"eval a=\$$aecho "now a = $a"# ./test.sh a = abcdnow a = 1234

2012-12-03 18:44:42 3406

原创 参数替换

${parameter-default} -- 如果变量parameter没被声明, 那么就使用默认值.${parameter:-default} -- 如果变量parameter没被设置, 那么就使用默认值.#!/bin/bashecho ${username-`whoami`}username=echo ${username:-`whoami`}username=inp

2012-12-03 16:32:42 384

原创 shell 函数,去掉传递进来参数开头的0

#!/bin/bash# 去掉传递进来参数开头的0(也可能是多个0),如果不去掉bash会把这个值当做8进制来解释strip_leading_zero (){    shopt -s extglob             # 打开扩展通配(globbing)    local val=${1##+(0)}         # 使用局部变量,匹配最长连续一个或多个0

2012-12-01 10:20:30 4962

原创 shell条件判断 条件为何值时判断语句为真

#!/bin/bashif [ 0 ]then    echo "0 is true"else    echo "0 is flase"fiif [ 1 ]then    echo "1 is true"else    echo "1 is flase"fiif [ -1 ]then    echo "-1 is true"

2012-11-30 14:00:10 1754

原创 tar 备份文件

将当前文件夹下文件备份至/home 如果不输入备份文件名称则使用backup+date#!/bin/bashBACKFILE=back-$(date +%m-%d-%y)  #备份文件中嵌入时间archive=${1:-$BACKFILE} #如果命令行中没有指定备份文件的文件名,将默认使用backupfiletar cvf - /usertest  > /ho

2012-11-30 09:20:57 548

原创 单引号内引入变量 shell 命令输出赋值给变量,以及用变量替换命令

单引号内嵌套单引号即可使用变量。#!/bin/bashi=10echo $iecho '$i'echo '$i is : '$i''执行结果# ./test.sh 10$i$i is : 10单引号内嵌套单引号即可使用变量。将命令赋值给变量,和将命令输出内容赋值给变量#!/bin/bash: ${username=`who

2012-11-29 16:09:58 44925 3

原创 监控linux 网络流量

修改了下网上搜索的监控网络流量的脚本  #!/bin/bash      if [ -n "$1" ]; then    eth_name=$1    else    eth_name="eth0"    fi    i=0    send_o=`expr $(ifconfig $eth_name | grep bytes | awk '{print $

2012-11-16 11:48:44 503

原创 监控linux机器负载脚本

top.sh &每隔一分钟记录一次cpu负载情况到top.txt文件#!/bin/bashwhile [ 1 ]do        top -b -n 1 |awk '/^top/||/Cpu/ {print}' >>top.txt        sleep 1mdonetop - 17:53:48 up 1 day,  3:44,  2 users,

2012-11-14 17:55:16 433

原创 centos 下mysql 密码设置,远程访问

http://www.linuxforum.net/books/mysqlmanual/manual_Privilege_system.html#User_names详细可以查看这个网址。shell> mysql -u root centos默认安装mysql无密码,mysql> use mysqlmysql> UPDATE user SET Passw

2012-11-08 14:31:40 435

原创 time 命令重定向问题

问题,一些命令输出无法定向到文件root@cloud01:~# time > a.txtreal    0m0.000suser    0m0.000ssys     0m0.000s执行后没有将输出打印到a.txt文件  time是shell关键字,将time 后面一整行作为命令执行了,root@cloud01:~# time ls > a.txtre

2012-11-02 15:12:42 611

转载 find 命令用法,根据时间,文件权限,查找文件

find pathname -options [-print -exec -ok]pathname   find命令所查找的目录路径。例如用.来表示当前目录,用/来表示系统根目录。-print   find命令将匹配的文件输出到标准输出。-exec   find命令对匹配的文件执行该参数所给出的 s h e l l命令。相应命令的形式为 ' command' {} \;,注意{ }和\

2012-10-25 13:49:41 1664

原创 逐行读取文本内容 循环读取字符串内容

time.txt 文本文件#!/bin/bashx=0cat time.txt | while read linedo    echo $x $line    x=$(($x+1))done或者#!/bin/bashx=0while read linedo    echo $x $line    x=$(($x+1))done

2012-10-24 16:43:52 2112

nginx+redhat5.5 负载均衡

今天学习了ngnix负载均衡,搭了个环境测试了下,并记录了搭建过程。nginx负载均衡配置过程,利用两台redhat 5.5服务器搭建了nginx的负载均衡。有图,安装过程。

2012-11-04

VT功能检测

Clicking on each of the three regions of SecurAble's display to obtain additional contextual information about each feature should provide all of the help you'll need to understand what's going on in any system SecurAble encounters. GRC's newsgroup community extensively tested SecurAble throughout its pre-release development. We were delighted to discover that SecurAble would sometimes inform its user of capabilities they were not aware their systems possessed. This would often trigger a search through their system's BIOS configuration screens to uncover BIOS settings which had previously escaped notice. And something similar happened to me: As you can see from the image to the left (click for full size) I discovered that my HP TC1100 TabletPC contains a Pentium M processor with hardware DEP capabilities. The only problem was that SecurAble was displaying "OFF" for DEP, indicating that although the processor offered hardware DEP support, something had disabled it. That "something" could only be the system's BIOS. So I went searching through the TC1100's BIOS screens for some way to enable the processor's support for hardware DEP . . . but there no mention of it in the BIOS. Other pre-release testers in our newsgroups were reporting the same thing, so I knew that “SecurAble” would not be the last hardware DEP-related freeware emerging from this work. Controlling processor features that have been neglected by systems' BIOSes will be one of the capabilities we will be exploring and developing in the follow-on “DEPuty” utility.

2012-03-17

3d 桌面特效驱动安装

最近在学习Fedora,发现中文的关于linux 3D桌面的文章好多讲的一知半解的,很郁闷,于是搜索了一边外文的感觉还挺全的,翻译了下不过翻译水平有限。

2010-01-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除