在gentoo上使用又显示器,扩展,镜像

首先需要在xorg.conf的下面这节中设置Virtual 值,这个值等于两个显示器的长度和、宽度和。

Section "Screen"
Identifier "aticonfig-Screen[0]-0"
Device "aticonfig-Device[0]-0"
Monitor "aticonfig-Monitor[0]-0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Virtual 2944 1200
EndSubSection
EndSection

注意其中加重的一行。这一行一般在两个显示分辨率不同的时候会用到,否则在使用xrandr设置启动另外的显示器的时候,会出现下面的错误:

然后在命令行,输入下面的命令,启动扩展显示器:
xrandr --output VGA-0 --right-of LVDS --auto

有几个参数,根据相应的情况修改,VGA-0可能是其他的名字,--right-of 表示在右边扩展,可以使用--left-off在左边扩展。
--auto 也可以改为--mode aaaaxbbbb

附:
xrandr 命令行可以很方便地切换双屏,常用方式如下,其他的可以自己探索:
xrandr --output VGA --same-as LVDS --auto
打开外接显示器(最高分辨率),与笔记本液晶屏幕显示同样内容(克隆)
xrandr --output VGA --same-as LVDS --mode 1024x768
打开外接显示器(分辨率为1024x768),与笔记本液晶屏幕显示同样内容(克隆)
xrandr --output VGA --right-of LVDS --auto
打开外接显示器(最高分辨率),设置为右侧扩展屏幕
xrandr --output VGA --off
关闭外接显示器
xrandr --output VGA --auto --output LVDS --off
打开外接显示器,同时关闭笔记本液晶屏幕(只用外接显示器工作)
xrandr --output VGA --off --output LVDS --auto
关闭外接显示器,同时打开笔记本液晶屏幕 (只用笔记本液晶屏)
(最后两种情况请小心操作,不要误把两个屏幕都关掉了。。。。)

用公司新配的电脑写离职报告

3个月才到的电脑,没想到最后一时刻到了,却是用来写离职报告,缪.
这个世界真滑烧.

发现一个有用的命令pidof

这个linux命令找到某个名字的进程的pid值。如果找不到,则返回空值。

PIDOF(8) Linux System Administrator's Manual PIDOF(8)

NAME
pidof -- find the process ID of a running program.

SYNOPSIS
pidof [-s] [-c] [-x] [-o omitpid] [-o omitpid..] program [program..]

DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints those id's
on the standard output. This program is on some systems used in run-level
change scripts, especially when the system has a System-V like rc structure. In
that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If
the system has a start-stop-daemon (8) program that should be used instead.

OPTIONS
-s Single shot - this instructs the program to only return one pid.

-c Only return process ids that are running with the same root directory.
This option is ignored for non-root users, as they will be unable to
check the current root directory of processes they do not own.

-x Scripts too - this causes the program to also return process id's of
shells running the named scripts.

-o omitpid
Tells pidof to omit processes with that process id. The special pid
%PPID can be used to name the parent process of the pidof program, in
other words the calling shell or shell script.

EXIT STATUS
0 At least one program was found with the requested name.

1 No program was found with the requested name.

NOTES
pidof is actually the same program as killall5; the program behaves according
to the name under which it is called.

When pidof is invoked with a full pathname to the program it should find the
pid of, it is reasonably safe. Otherwise it is possible that it returns pids of
running programs that happen to have the same name as the program you're after
but are actually other programs.

SEE ALSO
shutdown(8), init(8), halt(8), reboot(8), killall5(8)

AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl

01 Sep 1998 PIDOF(8)

drbd的使用

一. DRBD介绍

DRBD是一种块设备,可以被用于高可用(HA)之中.它类似于一个网络RAID-1功能.当你将数据写入本地

文件系统时,数据还将会被发送到网络中另一台主机上.以相同的形式记录在一个文件系统中.

本地(主节点)与远程主机(备节点)的数据可以保证实时同步.当本地系统出现故障时,远程主机上还会

保留有一份相同的数据,可以继续使用.



在高可用(HA)中使用DRBD功能,可以代替使用一个共享盘阵.因为数据同时存在于本地主机和远程主机上,

切换时,远程主机只要使用它上面的那份备份数据,就可以继续进行服务了.

DRBD的工作原理如下图:








        +--------+
        |  文件系统 |
        +--------+
             |
             V
        +----------+
        |   块设备层  |
        | (/dev/drbd1) |
        +----------+
         |            |
         |            |
         V           V
   +----------+  +-----------+
   |  本地硬盘   |   | 远程主机硬盘 |
   | (/dev/hdb1)  |   | (/dev/hdb1)  |
   +----------+  +-----------+

二. DRBD的安装

从官方网站下载源码包:

www.drbd.org

我们在Turbolinux10.5上使用drbd-8.0.4版.分别在两台主机上安装DRBD:

# tar jxf drbd-8.0.4.tar.gz
# cd drbd-8.0.4
# make
# make install

make install执行之后:

drbd.ko被安装到/lib/modules/$KernelVersion/kernel/drivers/block下.

drbd相关工具(drbdadm,drbdsetup)被安装到/sbin下.

并会在/etc/init.d/下建立drbd启动脚本.


三. DRBD的配置

1.DRBD使用的硬盘分区

你需要为本地主机和远程主机,指定一个DRBD使用的硬盘分区.这两个分区的大小必须相同.

我们指定两台主机的/dev/hdb1分区作为DRBD的使用的分区.这两个分区大小都为300MB.


2.drbd.conf配置文件

DRBD运行时,会读取一个配置文件/etc/drbd.conf.这个文件里描述了DRBD设备与硬盘分区的映射关系,

DRBD的一些配置参数.

下面是一个drbd.conf文件的简单示例:

<主机>Turbolinux 10.5操作系统,主机名为g105-1,IP地址为 10.0.1.2,DRBD分区为/dev/hdb1.

<备机>Turbolinux 10.5操作系统,主机名为g105-2,IP地址为 10.0.2.2,DRBD分区为/dev/hdb1.





       # 是否参加DRBD使用者统计.默认是yes
       global { usage-count yes; }
       # 设置主备节点同步时的网络速率最大值,单位是字节.
       common { syncer { rate 1M; } }
       # 一个DRBD设备(即:/dev/drbdX),叫做一个"资源".里面包含一个DRBD设备的主备节点的
       # 相关信息.
       #
       resource r0 {
            # 使用协议C.表示收到远程主机的写入确认后,则认为写入完成.
            protocol C; 
            net {
                 # 设置主备机之间通信使用的信息算法.
                 cram-hmac-alg sha1;
                 shared-secret "FooFunFactory";
            }
            # 每个主机的说明以"on"开头,后面是主机名.在后面的{}中为这个主机的配置.
            on g105-1 {
                 # /dev/drbd1使用的磁盘分区是/dev/hdb1
                 device    /dev/drbd1;
                 disk      /dev/hdb1;
                 # 设置DRBD的监听端口,用于与另一台主机通信
                 address   10.0.1.2:7898;
                 meta-disk  internal;
            }
            on g105-2 {
                 device    /dev/drbd1;
                 disk      /dev/hdb1;
                 address   10.0.2.2:7898;
                 meta-disk  internal;
            }
       }

然后将这个drbd.conf文件分别复制到两台主机的/etc目录下.

3.DRBD的启动

在启动DRBD之前,你需要分别在两台主机的hdb1分区上,创建供DRBD记录信息的数据块.分别在

两台主机上执行:


[root@g105-1 /]# drbdadm create-md r0
[root@g105-2 /]# drbdadm create-md r0

“r0”是我们在drbd.conf里定义的资源名称.

现在我们可以启动DRBD了,分别在两台主机上执行:


[root@g105-1 /]# /etc/init.d/drbd start
[root@g105-2 /]# /etc/init.d/drbd start

现在可以查看DRBD的状态,然后在g105-1主机上执行:

[root@g105-1 /]# cat /proc/drbd
version: 8.0.4 (api:86/proto:86)
SVN Revision: 2947 build by root@g105-1, 2007-07-28 07:22:30

 1: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent C r---
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
        resync: used:0/31 hits:0 misses:0 starving:0 dirty:0 changed:0
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0

”/proc/drbd”中显示了drbd当前的状态.第一行的st表示两台主机的状态,都是”备机”状态.

ds是磁盘状态,都是”不一致”状态.

这是由于,DRBD无法判断哪一方为主机,以哪一方的磁盘数据作为标准数据.所以,我们需要初始化

一个主机.在g105-1上执行:




[root@g105-1 /]# drbdsetup /dev/drbd1 primary -o

现在再看一个g105-1上的DRBD状态:

[root@g105-1 /]# cat /proc/drbd
version: 8.0.4 (api:86/proto:86)
SVN Revision: 2947 build by root@g105-1, 2007-07-28 07:22:30

 1: cs:SyncSource st:Primary/Secondary ds:UpToDate/Inconsistent C r---
    ns:42688 nr:0 dw:0 dr:42688 al:0 bm:2 lo:4 pe:0 ua:4 ap:0
        [==>.................] sync'ed: 14.7% (262464/305152)K
        finish: 0:02:58 speed: 1,440 (1,292) K/sec
        resync: used:1/31 hits:2669 misses:3 starving:0 dirty:0 changed:3
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0

主备机状态分别是”主/备”,主机磁盘状态是”实时”,备机状态是”不一致”.

在第3行,可以看到数据正在同步中,即主机正在将磁盘上的数据,传递到备机上.现在的进度是14.7%.

现在看一下g105-2上面的DRBD状态.



[root@g105-2 /]# cat /proc/drbd
version: 8.0.4 (api:86/proto:86)
SVN Revision: 2947 build by root@g105-2, 2007-07-28 07:13:14

 1: cs:SyncTarget st:Secondary/Primary ds:Inconsistent/UpToDate C r---
    ns:0 nr:56608 dw:56608 dr:0 al:0 bm:3 lo:0 pe:0 ua:0 ap:0
        [===>................] sync'ed: 20.0% (248544/305152)K
        finish: 0:02:57 speed: 1,368 (1,284) K/sec
        resync: used:0/31 hits:3534 misses:4 starving:0 dirty:0 changed:4
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0

稍等一会,在数据同步完后,再查看一下g105-1的DRBD状态:

[root@g105-1 /]# cat /proc/drbd
version: 8.0.4 (api:86/proto:86)
SVN Revision: 2947 build by root@g105-1, 2007-07-28 07:22:30

 1: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
    ns:305152 nr:0 dw:0 dr:305152 al:0 bm:19 lo:0 pe:0 ua:0 ap:0
        resync: used:0/31 hits:19053 misses:19 starving:0 dirty:0 changed:19
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0

磁盘状态都是”实时”,表示数据同步完成了.

4.使用DRBD

你现在可以把主机上的DRBD设备挂载到一个目录上进行使用.备机的DRBD设备无法被挂载,因为它是

用来接收主机数据的,由DRBD负责操作.

在g105-1上执行:



[root@g105-1 /]# mount /dev/drbd1 /mnt/drbd1
[root@g105-1 /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3             9.3G  6.5G  2.4G  73% /
/dev/hda1              99M  9.3M   85M  10% /boot
none                  249M     0  249M   0% /dev/shm
/dev/drbd1            289M   11M  264M   4% /mnt/drbd1

现在,我们在drbd1目录里建立一个200M的文件:

[root@g105-1 /]# dd if=/dev/zero of=/mnt/drbd1/tempfile1.tmp bs=104857600 count=2

操作完成后,在g105-2(备机)上执行:

我们先停止DRBD


[root@g105-2 /]# /etc/init.d/drbd stop

现在,我们可以将hdb1进行挂载

[root@g105-2 /]# mount /dev/hdb1 /mnt/drbd1
[root@g105-2 /]# ls /mnt/drbd1 -hl
total 201M
drwx------  2 root root  12K Jul 28 23:44 lost+found
-rw-r--r--  1 root root 200M Jul 29 00:20 tempfile1.tmp
[root@g105-2 /]# umount /mnt/drbd1

可以看到,在主机g105-1上产生的文件tmpfile1.tmp,也完整的保存在备机g105-2的DRBD分区上.

这就是DRBD的网络RAID-1功能. 在主机上的任何操作,都会被同步到备机的相应磁盘分区上,达到数据备份的效果.


5.DRBD的主备机切换

有时,你需要将DRBD的主备机互换一下.可以执行下面的操作:

在主机上,先要卸载掉DRBD设备.


[root@g105-1 /]# umount /mnt/drbd1

将主机降级为”备机”.

[root@g105-1 /]# drbdadm secondary r0
[root@g105-1 /]# cat /proc/drbd
version: 8.0.4 (api:86/proto:86)
SVN Revision: 2947 build by root@g105-1, 2007-07-28 07:13:14

 1: cs:Connected st:Secondary/Secondary ds:UpToDate/UpToDate C r---
    ns:0 nr:5 dw:5 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
        resync: used:0/31 hits:0 misses:0 starving:0 dirty:0 changed:0
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0

现在,两台主机都是”备机”.

在备机g105-2上,将它升级为”主机”.


[root@g105-2 /]# drbdadm primary r0
[root@g105-2 /]# cat /proc/drbd
version: 8.0.4 (api:86/proto:86)
SVN Revision: 2947 build by root@g105-2, 2007-07-28 07:13:14

 1: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
    ns:0 nr:5 dw:5 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
        resync: used:0/31 hits:0 misses:0 starving:0 dirty:0 changed:0
        act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0

现在,g105-2成为了”主机”.你可以把它的/dev/drbd1进行挂载和使用了.同样,数据会被同步到

g105-1上面.


通过代理服务器访问http协议svn的方法

在*nix系统上,每个用户使用svn的时候会在$HOME目录下生成一个.subversion目录,目录下存放svn相关的配置及访问服务器相关的配置。

其中有一个叫servers的文件,指定访问服务器的一些参数,该配置文件主要包含三个小节,groups, groupxxx, global, 现在要想对 googlecode.com域名下的svn访问做个设置,那么,先在groups中添加一个针对这个域名的名字,如group_google_code.

再在最后添加一个叫[group_google_code]的小节,添加两个变量设置,
http-proxy-host = 127.0.0.1
http-proxy-port = 8118

如果这个代理需要用户名和密码的话,还需要添加下列变量。
# http-proxy-username = defaultusername
# http-proxy-password = defaultpassword

保存退出,现在使用svn命令的时候,就会通过代理访问googlecode.com域名下的svn了。

开源项目管理软件,禅道ZenTaoPMS0.4 beta发布

in

禅道项目管理软件(ZenTaoPMS)是一款国产的,基于LGPL协议,开源免费的项目管理软件,它集产品管理、项目管理、测试管理于一体,同时还包含了事务管理、组织管理等诸多功能,是中小型企业项目管理的首选。 禅道项目管理软件使用PHP + MySQL开发,基于自主的PHP开发框架──ZenTaoPHP而成。第三方开发者或者企业可以非常方便的开发插件或者进行定制。

大家好,我非常高兴的向大家宣布,禅道项目管理软件ZenTaoPMS正式发布0.4beta版本。

一、下载地址

http://zentaoms.googlecode.com/files/ZenTaoPMS.0.4.0.beta.zip

二、该版本的改动如下:

1. 项目增加了build功能。
2. 产品增加了发布和路线图功能。
3. Bug管理增加了对build的支持。
4.  新增了升级功能。
5. 我的地盘中增加了“我的需求”功能。
6. 需求增加了搜索功能,完善了bug和case的搜索功能。
7. 需求增加了上传附件功能。
8. 调整了bug的显示和编辑界面,使之更加合理清晰。
9. 完善了后台分组管理的界面。
10. 修复了之前版本的若干bug。

三、安装

1. 首先安装apache, php, mysql的运行环境。推荐大家使用xampp: http://www.apachefriends.org/zh_cn/xampp.html
2. 将ZenTaoPMS下载下来之后,解压缩apache的www目录。
3. 通过浏览器访问 zentaopms/www/index.php,系统会自动转入安装程序,然后按照提示进行就可以了。

四、升级

1. 将原来的zentaopms目录改名,比如改为zentaopms.bak
2. 下载最新的zentaopms包,将其解压缩为zentaopms。 
3. 将zentaopms.bak目录中app/pms/config/my.php拷贝到最新的zentaopms/config/目录下面。
4. 修改最新的zentaopms/config/my.php,将其中的webRoot变量的路径,修改为实际的路径。比如原来可能是/zentaopms/app/pms/www/,最新的版本只需要是/zetnaopms/www/ 就可以了,比原来省了两级目录。
5. 将旧的zentaopms.bak目录中app/pms/www/data目录拷贝到zentaopms/www/目录下面,注意要修改其权限可读可写。
6. 访问最新的zentaopms,注意,访问路径比之前缩短了。
7, 进入后台管理,点击升级,升级数据库。

五、欢迎新朋友加入

这期项目中,新加入了sophia, leebay, xieyanfu,circleoflife等几位朋友,感谢你们的加入!也期待更多朋友的加入。

两款KDE SC 4.4发布倒计时

in

KDE SC 4.4 Release Counter

KDE SC 4.4 Release Counter

获取shell脚本的进程ID

在脚本运行的时候,通过shell的$$变量可以获取到shell脚本的进程id号,

而后可以把这个值传递给其他的变量,像:

SHPID=$$

echo $SHPID

支持microsoft project的跨平台project程序

主页: http://www.openproj.org
开发语言,java
开源,开源与商业双协议,功能上有少许不同。

为gentoo写了一个简单的安装ebuild

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
 
 
EAPI="2"
inherit eutils
 
DESCRIPTION="OpenProj is a desktop replacement of Microsoft Project"
HOMEPAGE="http://www.openproj.org"
SRC_URI="mirror://sourceforge/openproj/${P}.tar.gz"
RESTRICT="fetch"
 
LICENSE="CPAL"
# LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
 
# TODO add depend jdk section
 
src_install() {
        declare OPENPROJ_HOME=/opt/openproj
 
        dodir ${OPENPROJ_HOME}
        cp -R * "${D}"${OPENPROJ_HOME} || die "Unable to install openproj folder"
 
        # Create openproj wrapper
        make_wrapper openproj ./openproj.sh ${OPENPROJ_HOME} ${OPENPROJ_HOME}/lib:${OPENPROJ_HOME
}
        newicon "${FILESDIR}"/openproj.png ${PN}.png
        make_desktop_entry openproj "Openproj" ${PN} "Office"
}

ssh客户端库libssh特性列表

  • Full C library functions for manipulating a client-side SSH connection
  • SSH2 and SSH1 protocol compliant
  • Fully configurable sessions
  • Server support
  • SSH agent authentication support
  • Support for AES-128, AES-192, AES-256, Blowfish, 3DES in CBC mode
  • Supports OpenSSL and GCrypt
  • Use multiple SSH connections in a same process, at same time
  • Use multiple channels in the same connection
  • Thread safety when using different sessions at same time
  • POSIX-like SFTP (Secure File Transfer) implementation with openssh extension support
  • SCP implementation
  • Large file system support (files bigger than 4GB)
  • RSA and DSS server public key supported
  • Compression support (with zlib)
  • Public key (RSA and DSS), password and keyboard-interactive authentication
  • Full poll() support and poll-emulation for win32.
  • A complete doxygen documentation about its API
  • Runs and tested under x86_64, x86, ARM, Sparc32, PPC under Linux, BSD, MacOSX, Solaris and Windows
  • Developers listening to you
  • It’s free (LGPL)!
Syndicate content