<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>wd and cc &#187; Other</title>
	<atom:link href="http://wdicc.com/category/other/feed/" rel="self" type="application/rss+xml" />
	<link>http://wdicc.com</link>
	<description>Happy every day...</description>
	<lastBuildDate>Wed, 01 Feb 2012 03:27:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>安装配置一台 apache+php+mysql 的rh el4服务器</title>
		<link>http://wdicc.com/setup-apache-mysql-php-in-rhel4/</link>
		<comments>http://wdicc.com/setup-apache-mysql-php-in-rhel4/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 03:01:00 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/setup-apache-mysql-php-in-rhel4/</guid>
		<description><![CDATA[系统 rh el4 是四张盘，用第一张启动电脑。前面没啥好说的了，后面选择软件的时候，不要选x界面的东西，开发工具全选上，别的好像默认就行了，大概需要2G好像是。 Apache apache的下载地址：http://httpd.apache.org/download.cgi，选一个mirror，下载就行了。 编译选项： ./configure &#8211;prefix=/usr/local/apache/ &#8211;enable-rewrite &#8211;enable-so rewrite还是很有必要装上的，enable so让apache可以加载php模块。 Mysql mysql 的下载地址(以5.0为例)：http://mysql.org/downloads/mysql/5.0.html#source 注意我们这里下载的是 source，要自己来编译。这样可以控制mysql默认的字符集是什么。 编译选项： ./configure &#8211;prefix=/data/mysql &#8211;with-charset=gbk &#8211;with-extra-charsets=all 这里设置的字符集是gbk，根据需要自己来设计自己的。别的安装的过程可以参考源码目录里面的INSTALL文件，基本按照那个一步一步来就行了。 libjpeg 安装php之前，先需要自己编译一个 libjpeg 和 libpng，系统安装的少东西，php编译不过去。 libjpeg 的下载地址：ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz 编译选项：./configure &#8211;enable-static &#8211;enable-shared &#8211;prefix=/usr/local/libjpeg libpng libpng的下载地址：http://prdownloads.sourceforge.net/libpng/libpng-1.2.20.tar.bz2?download 编译选项：./configure &#8211;prefix=/usr/local/libpng php php的下载地址(目前的最新版)：http://cn.php.net/get/php-5.2.4.tar.bz2/from/this/mirror 编译选项： ./configure &#8211;with-apxs2=/usr/local/apache/bin/apxs &#8211;with-mysql=/data/mysql/&#160; &#8211;prefix=/usr/local/php5/ &#8211;with-config-file-path=/usr/local/php5/etc &#8211;with-openssl &#8211;enable-mbstring &#8211;with-iconv &#8211;with-curl &#8211;with-gd &#8211;with-zlib&#160; &#8211;with-png-dir=/usr/local/libpng &#8211;with-jpeg-dir=/usr/local/libjpeg]]></description>
			<content:encoded><![CDATA[<p><strong>系统</strong></p>
<p>rh el4 是四张盘，用第一张启动电脑。前面没啥好说的了，后面选择软件的时候，不要选x界面的东西，开发工具全选上，别的好像默认就行了，大概需要2G好像是。</p>
<p><strong>Apache</strong></p>
<p>apache的下载地址：<a title="http://httpd.apache.org/download.cgi" href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a>，选一个mirror，下载就行了。</p>
<p>编译选项： ./configure &#8211;prefix=/usr/local/apache/ &#8211;enable-rewrite &#8211;enable-so</p>
<p>rewrite还是很有必要装上的，enable so让apache可以加载php模块。</p>
<p><strong>Mysql</strong></p>
<p>mysql 的下载地址(以5.0为例)：<a title="http://mysql.org/downloads/mysql/5.0.html#source" href="http://mysql.org/downloads/mysql/5.0.html#source">http://mysql.org/downloads/mysql/5.0.html#source</a></p>
<p>注意我们这里下载的是 source，要自己来编译。这样可以控制mysql默认的字符集是什么。</p>
<p>编译选项： ./configure &#8211;prefix=/data/mysql &#8211;with-charset=gbk &#8211;with-extra-charsets=all</p>
<p>这里设置的字符集是gbk，根据需要自己来设计自己的。别的安装的过程可以参考源码目录里面的INSTALL文件，基本按照那个一步一步来就行了。</p>
<p><strong>libjpeg</strong></p>
<p>安装php之前，先需要自己编译一个 libjpeg 和 libpng，系统安装的少东西，php编译不过去。</p>
<p>libjpeg 的下载地址：<a title="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz" href="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz">ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz</a></p>
<p>编译选项：./configure &#8211;enable-static &#8211;enable-shared &#8211;prefix=/usr/local/libjpeg</p>
<p><strong>libpng</strong></p>
<p>libpng的下载地址：<a title="http://prdownloads.sourceforge.net/libpng/libpng-1.2.20.tar.bz2?download" href="http://prdownloads.sourceforge.net/libpng/libpng-1.2.20.tar.bz2?download">http://prdownloads.sourceforge.net/libpng/libpng-1.2.20.tar.bz2?download</a></p>
<p>编译选项：./configure &#8211;prefix=/usr/local/libpng</p>
<p><strong>php</strong></p>
<p>php的下载地址(目前的最新版)：<a title="http://cn.php.net/get/php-5.2.4.tar.bz2/from/this/mirror" href="http://cn.php.net/get/php-5.2.4.tar.bz2/from/this/mirror">http://cn.php.net/get/php-5.2.4.tar.bz2/from/this/mirror</a></p>
<p>编译选项：</p>
<p>./configure &#8211;with-apxs2=/usr/local/apache/bin/apxs &#8211;with-mysql=/data/mysql/&nbsp; &#8211;prefix=/usr/local/php5/ &#8211;with-config-file-path=/usr/local/php5/etc &#8211;with-openssl &#8211;enable-mbstring &#8211;with-iconv &#8211;with-curl &#8211;with-gd &#8211;with-zlib&nbsp; &#8211;with-png-dir=/usr/local/libpng &#8211;with-jpeg-dir=/usr/local/libjpeg</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/setup-apache-mysql-php-in-rhel4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gdm登陆窗口的方块乱码</title>
		<link>http://wdicc.com/gdm-problem/</link>
		<comments>http://wdicc.com/gdm-problem/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 02:36:34 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/gdm-problem/</guid>
		<description><![CDATA[这几天一直有个问题解决不了，gdm的登陆窗口上面的字体是方块。我一般都是使用home下面的.fonts.conf 来配置字体的。不过gdm启动的时候好像也不会读取你home的下吧，所以还是把他放到了/etc/fonts/local.conf 里面。 使用gdm的时候，配置为theme的时候，gdm会起不了，不停的尝试，最后出一个提示窗口，全是方块。不过应该是提示没办法启动welcome窗口的。配置为简介模式的话，gdm至少能起来，虽然上面的字体全是方块，连我输入的字也是方块，就算是英文。 开始以为是字体设置的问题，把我的自定义设置全部去掉也不行。locale改成英文就正常了。不过还是不爽，搜了半天没找到解决办法，后来有篇文章提示了一下，会不会是字体权限的问题？我才想起来自己添加的雅黑字体，去看了一下，果然只有root可读。修改权限之后，方块的现象没了。]]></description>
			<content:encoded><![CDATA[<p>这几天一直有个问题解决不了，gdm的登陆窗口上面的字体是方块。我一般都是使用home下面的.fonts.conf 来配置字体的。不过gdm启动的时候好像也不会读取你home的下吧，所以还是把他放到了/etc/fonts/local.conf 里面。</p>
<p>使用gdm的时候，配置为theme的时候，gdm会起不了，不停的尝试，最后出一个提示窗口，全是方块。不过应该是提示没办法启动welcome窗口的。配置为简介模式的话，gdm至少能起来，虽然上面的字体全是方块，连我输入的字也是方块，就算是英文。</p>
<p>开始以为是字体设置的问题，把我的自定义设置全部去掉也不行。locale改成英文就正常了。不过还是不爽，搜了半天没找到解决办法，后来有篇文章提示了一下，会不会是字体权限的问题？我才想起来自己添加的雅黑字体，去看了一下，果然只有root可读。修改权限之后，方块的现象没了。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/gdm-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>给ibm server设置raid</title>
		<link>http://wdicc.com/raid-on-ibm-server/</link>
		<comments>http://wdicc.com/raid-on-ibm-server/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 01:40:36 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/raid-on-ibm-server/</guid>
		<description><![CDATA[昨天去给一台没拆封的ibm server装系统，头一次弄了raid，发现操作起来也不难。之前心里没底，就去yahoo搜索了一下，发现图解的都是使用server guide 那个光盘安装windows的（其实就一篇文章，n多人转载了），这次装就顺便拍了一下，呵呵。 server guide 光盘的图，用serverguide安装也挺简单的，光盘启动之后按照提示一步一步来就行了。 拆封之后，把硬盘（最少2块，1块做什么raid？）都插上，要注意使劲往里推。然后接上电源、显示器和键盘，就可以开机了。图片都可以在这里看到。 开机后第二屏信息，上面是2块网卡的信息。提示&#60;CTRL&#62;&#60;A&#62;的时候，按ctrl+a。 按了ctrl+a之后会多出来一行提示，告诉你等会会进入raid的设置界面。 ok，这就是这个界面了。就选第一个 Array Configuration Utility。 先得初始化一下硬盘。其实这会如果直接 create array的话，他也会提示你需要先初始化硬盘的。 先查找连接上来的硬盘。 找到2块。按insert键选择硬盘，选了之后会在右边的窗口出现。这里是需要2块全选的。选好后，按回车确定。 提示你初始化会删除所有数据。确定，输入yes。此后就开始初始化，我这里好像很快。 初始化完毕之后又会返回这个菜单，这次选 create array。 再来选硬盘。选完按回车。 出现raid的设置界面。我就2块硬盘，只有raid 0和1可选。选需要的。 别的都默认好了，不清楚有什么差别。 这就可以done了。之后会重启。 看到那个raid信息了吧。]]></description>
			<content:encoded><![CDATA[<p>昨天去给一台没拆封的ibm server装系统，头一次弄了raid，发现操作起来也不难。之前心里没底，就去yahoo搜索了一下，发现图解的都是使用server guide 那个光盘安装windows的（其实就一篇文章，n多人转载了），这次装就顺便拍了一下，呵呵。</p>
<p>server guide 光盘的图，用serverguide安装也挺简单的，光盘启动之后按照提示一步一步来就行了。</p>
<p><img src="http://photo11.yupoo.com/20070916/085847_910633405.jpg" /></p>
<p><img src="http://photo11.yupoo.com/20070916/085837_2093046889.jpg" /></p>
<p><span id="more-381"></span></p>
<p>拆封之后，把硬盘（最少2块，1块做什么raid？）都插上，要注意使劲往里推。然后接上电源、显示器和键盘，就可以开机了。图片都可以在<a href="http://www.yupoo.com/albums/view?id=ff80808114fa6bd801150bd0b8ab6243">这里</a>看到。</p>
<p><img src="http://photo5.yupoo.com/20070916/085619_251160821.jpg" /></p>
<p>开机后第二屏信息，上面是2块网卡的信息。提示&lt;CTRL&gt;&lt;A&gt;的时候，按ctrl+a。</p>
<p><img src="http://photo5.yupoo.com/20070916/085627_387692339.jpg" /></p>
<p>按了ctrl+a之后会多出来一行提示，告诉你等会会进入raid的设置界面。</p>
<p><img src="http://photo11.yupoo.com/20070916/085634_622747700.jpg" /></p>
<p>ok，这就是这个界面了。就选第一个 Array Configuration Utility。</p>
<p><img src="http://photo11.yupoo.com/20070916/085644_1443274542.jpg" /></p>
<p>先得初始化一下硬盘。其实这会如果直接 create array的话，他也会提示你需要先初始化硬盘的。</p>
<p><img src="http://photo5.yupoo.com/20070916/085653_409760939.jpg" /></p>
<p>先查找连接上来的硬盘。</p>
<p><img src="http://photo11.yupoo.com/20070916/085724_132744006.jpg" /></p>
<p>找到2块。按insert键选择硬盘，选了之后会在右边的窗口出现。这里是需要2块全选的。选好后，按回车确定。</p>
<p><img src="http://photo11.yupoo.com/20070916/085704_25723597.jpg" /></p>
<p>提示你初始化会删除所有数据。确定，输入yes。此后就开始初始化，我这里好像很快。</p>
<p><img src="http://photo11.yupoo.com/20070916/085714_1883779879.jpg" /></p>
<p>初始化完毕之后又会返回这个菜单，这次选 create array。</p>
<p><img src="http://photo5.yupoo.com/20070916/085740_911137399.jpg" /></p>
<p>再来选硬盘。选完按回车。</p>
<p><img src="http://photo5.yupoo.com/20070916/085750_1590784025.jpg" /></p>
<p>出现raid的设置界面。我就2块硬盘，只有raid 0和1可选。选需要的。</p>
<p><img src="http://photo11.yupoo.com/20070916/085759_322804327.jpg" /></p>
<p>别的都默认好了，不清楚有什么差别。</p>
<p><img src="http://photo11.yupoo.com/20070916/085807_924423596.jpg" /></p>
<p>这就可以done了。之后会重启。</p>
<p><img src="http://photo11.yupoo.com/20070916/085819_1295559709.jpg" /></p>
<p>看到那个raid信息了吧。</p>
<p><img src="http://photo5.yupoo.com/20070916/085836_2002971014.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/raid-on-ibm-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>涉及到linux系统安全的几个文件</title>
		<link>http://wdicc.com/some-importent-files-in-linux/</link>
		<comments>http://wdicc.com/some-importent-files-in-linux/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 06:27:40 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[secure]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/some-importent-files-in-linux/</guid>
		<description><![CDATA[部分内容转自这里 1 cron.allow,cron.deny If the cron.allow file exists, then you must be listed therein in order to be allowed to use this command. If the cron.allow file does not exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command. If neither of [...]]]></description>
			<content:encoded><![CDATA[<p>部分内容转自<a href="http://man.chinaunix.net/linux/debian/debian_learning/index.html" target="_blank">这里</a></p>
<p><strong>1 cron.allow,cron.deny</strong></p>
<blockquote><p>If the cron.allow file exists, then you must be listed therein in order to  be  allowed  to  use  this  command.   If  the  cron.allow  file  does  not  exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command.  If neither of these files exists, only the super user will be allowed to use this command.</p>
</blockquote>
<p>上面是引用 man crontab 里面的一段解释。如果 cron.allow 存在，那里面的用户可以使用crontab命令。如果cron.allow 不存在，而 cron.deny 存在，那么列在里面的用户不可以使用crontab命令。如果都不存在，那么只允许super用户来使用这个命令。
<p>安装rh的时候，默认就会存在一个 cron.deny 的空文件，所以普通用户也可以使用crontab。
<p><strong>2 at.allow,at.deny</strong><br />
<blockquote>
<p>The  superuser  may  use  these  commands  in  any case.  For other users, permission to use at is determined by the files<br />/etc/at.allow and /etc/at.deny. </p>
<p>If the file /etc/at.allow exists, only usernames mentioned in it are allowed to use at. </p>
<p>If /etc/at.allow does not exist, /etc/at.deny is checked, every username not mentioned in it is then allowed to use at.
<p>If neither exists, only the superuser is allowed use of at.
<p>An empty /etc/at.deny means that every user is allowed use these commands, this is the default configuration.</p>
</blockquote>
<p>这个其实和上面那个是类似的。默认也是有个空的 at.deny 文件，允许所有用户使用at。
<p><strong>3 /etc/security/access.conf</strong><br />
<blockquote>
<p># Login access control table.<br /># <br /># When someone logs in, the table is scanned for the first entry that<br /># matches the (user, host) combination, or, in case of non-networked<br /># logins, the first entry that matches the (user, tty) combination.  The<br /># permissions field of that table entry determines whether the login will <br /># be accepted or refused.</p>
</blockquote>
<p>login 权限控制表。可以控制允许登陆的ip，登陆的tty等信息。<br />
<blockquote>
<p># Disallow console logins to all but a few accounts.<br />#<br />#-:ALL EXCEPT wheel shutdown sync:LOCAL</p>
</blockquote>
<p>比如可以设置只允许某些用户从本地登陆。建议设置root用户不能从本地登陆。
<p><strong>4 /etc/securetty</strong>
<p>该文件可控制根用户登录的设备，该文件里记录的是可以作为根用户登录的设备名，如tty1、tty2等。用户是不能从不存在于该文件里的设备登录为根用户的。这种情况用户只能以普通用户登录进来，再用su命令转为根用户。/etc/securetty文件的格式如下：
<pre># /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
console

# for people with serial port consoles
ttyS0

# for devfs
tts/0

# Standard consoles
tty1
tty2
tty3
...
</pre>
<p>如果/etc/securetty是一个空文件，则根用户就不能从任务的设备登录系统。只能以普通用户登录，再用su命令转成根用户。如果/etc/securetty文件不存在，那么根用户可以从任何地方登录。这样会引发安全问题，所以/etc/securetty文件在系统中是一定要存在的。</p>
<p><strong>5  /etc/login.defs</strong></p>
<p>login.defs是设置用户帐号限制的文件，在这里我们可配置密码的最大过期天数，密码的最大长度约束等内容。该文件里的配置对root用户无效。如果/etc/shadow文件里有相同的选项，则以/etc/shadow里的设置为准，也就是说/etc/shadow的配置优先级高于 /etc/login.defs。下面内容是该文件的节选：
<pre>...
#
# Password aging controls:
#
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
#       PASS_MIN_DAYS   Minimum number of days allowed between password change.
#       PASS_WARN_AGE   Number of days warning given before a password expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_WARN_AGE 7
...
#
# Number of significant characters in the password for crypt().
# Default is 8, don't change unless your crypt() is better.
# If using MD5 in your PAM configuration, set this higher.
#
PASS_MAX_LEN            8
...
</pre>
<p><strong>6 /etc/pam.d/su</strong></p>
<p>通过pam来限制su命令的使用。比如可以设置哪些组，哪些用户才能使用。</p>
<p>#auth       sufficient   /lib/security/$ISA/pam_wheel.so trust use_uid<br /># Uncomment the following line to require a user to be in the “wheel” group.<br />auth       required     /lib/security/$ISA/pam_wheel.so group=admin</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/some-importent-files-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>smsd 发送中文短信乱码</title>
		<link>http://wdicc.com/smsd-and-chinese/</link>
		<comments>http://wdicc.com/smsd-and-chinese/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 07:22:57 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[gnokii]]></category>
		<category><![CDATA[smsd]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/smsd-and-chinese/</guid>
		<description><![CDATA[smsd是使用mysql数据库的，所以这个乱码很容易把人搞晕。我之前写过gnokii发送短信是和locale有关系的，只要在utf8的locale下面就可以正常发送中文短信了。而smsd也和这个类似，也需要utf8的locale。但是还需要注意的一点就是mysql也是有编码设置的。所以可能会认为，文本插入数据库之前是不是也需要对数据库做utf8的设置呢？其实是不需要的，这么做反而会造成乱码。 smsd连接mysql用的是mysql默认的字符集，那么我们插入文本的时候，也同样需要使用这个字符集，需要注意的是，这个文本也需要是utf8编码的。mysql默认的字符集通常是 “default-character-set&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; latin1”。 我写的一个python的用来插入数据库要发送的信息的程序。 #!/usr/bin/env python2.3 #coding=utf-8 import sys import MySQLdb &#160; # inbox #+------------+------------------+------+-----+---------------------+----------------+ #&#124; Field &#124; Type &#124; Null &#124; Key &#124; Default &#124; Extra &#124; #+------------+------------------+------+-----+---------------------+----------------+ #&#124; id &#124; int(10) unsigned &#124; &#124; PRI &#124; NULL &#124; auto_increment &#124; #&#124; number &#124; varchar(20) &#124; &#124; &#124; &#124; &#124; #&#124; smsdate &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>smsd是使用mysql数据库的，所以这个乱码很容易把人搞晕。我之前<a href="http://blog.wdicc.com/wordpress/gnokii_howto_chinese_sms/">写过</a>gnokii发送短信是和locale有关系的，只要在utf8的locale下面就可以正常发送中文短信了。而smsd也和这个类似，也需要utf8的locale。但是还需要注意的一点就是mysql也是有编码设置的。所以可能会认为，文本插入数据库之前是不是也需要对数据库做utf8的设置呢？其实是不需要的，这么做反而会造成乱码。</p>
<p>smsd连接mysql用的是mysql默认的字符集，那么我们插入文本的时候，也同样需要使用这个字符集，需要注意的是，这个文本也需要是utf8编码的。mysql默认的字符集通常是 “default-character-set&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; latin1”。</p>
<p>我写的一个python的用来插入数据库要发送的信息的程序。</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="python"><span class="co1">#!/usr/bin/env python2.3</span>
<span class="co1">#coding=utf-8</span>
<span class="kw1">import</span> <span class="kw3">sys</span>
<span class="kw1">import</span> MySQLdb
&nbsp;
<span class="co1">#  inbox</span>
<span class="co1">#+------------+------------------+------+-----+---------------------+----------------+</span>
<span class="co1">#| Field      | Type             | Null | Key | Default             | Extra          |</span>
<span class="co1">#+------------+------------------+------+-----+---------------------+----------------+</span>
<span class="co1">#| id         | int(10) unsigned |      | PRI | NULL                | auto_increment |</span>
<span class="co1">#| number     | varchar(20)      |      |     |                     |                |</span>
<span class="co1">#| smsdate    | datetime         |      |     | 0000-00-00 00:00:00 |                |</span>
<span class="co1">#| insertdate | timestamp        | YES  |     | CURRENT_TIMESTAMP   |                |</span>
<span class="co1">#| text       | varchar(160)     | YES  |     | NULL                |                |</span>
<span class="co1">#| phone      | tinyint(4)       | YES  |     | NULL                |                |</span>
<span class="co1">#| processed  | tinyint(4)       |      |     | 0                   |                |</span>
<span class="co1">#+------------+------------------+------+-----+---------------------+----------------+</span>
&nbsp;
<span class="co1">#  outbox</span>
<span class="co1">#+----------------+------------------+------+-----+---------------------+----------------+</span>
<span class="co1">#| Field          | Type             | Null | Key | Default             | Extra          |</span>
<span class="co1">#+----------------+------------------+------+-----+---------------------+----------------+</span>
<span class="co1">#| id             | int(10) unsigned |      | PRI | NULL                | auto_increment |</span>
<span class="co1">#| number         | varchar(20)      |      |     |                     |                |</span>
<span class="co1">#| processed_date | timestamp        | YES  |     | CURRENT_TIMESTAMP   |                |</span>
<span class="co1">#| insertdate     | timestamp        | YES  |     | 0000-00-00 00:00:00 |                |</span>
<span class="co1">#| text           | varchar(160)     | YES  |     | NULL                |                |</span>
<span class="co1">#| phone          | tinyint(4)       | YES  |     | NULL                |                |</span>
<span class="co1">#| processed      | tinyint(4)       |      |     | 0                   |                |</span>
<span class="co1">#| error          | tinyint(4)       |      |     | -1                  |                |</span>
<span class="co1">#| dreport        | tinyint(4)       |      |     | 0                   |                |</span>
<span class="co1">#| not_before     | time             |      |     | 00:00:00            |                |</span>
<span class="co1">#| not_after      | time             |      |     | 23:59:59            |                |</span>
<span class="co1">#+----------------+------------------+------+-----+---------------------+----------------+</span>
&nbsp;
<span class="kw1">class</span> Mydb:
        <span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:
                <span class="kw1">try</span>:
                        <span class="kw2">self</span>.<span class="me1">db</span>=MySQLdb.<span class="me1">Connection</span><span class="br0">&#40;</span>host=<span class="st0">&quot;localhost&quot;</span>,<span class="kw3">user</span>=<span class="st0">&quot;gnokii&quot;</span>,
                                passwd=<span class="st0">&quot;gnokii&quot;</span>,db=<span class="st0">&quot;gnokii&quot;</span><span class="br0">&#41;</span>
&nbsp;
                <span class="kw1">except</span> MySQLdb.<span class="me1">OperationalError</span>, message:
                        errorMessage = <span class="st0">&quot;Error %d:<span class="es0">\n</span>%s&quot;</span> <span class="sy0">%</span> <span class="br0">&#40;</span>message<span class="br0">&#91;</span> <span class="nu0">0</span> <span class="br0">&#93;</span>, message<span class="br0">&#91;</span> <span class="nu0">1</span> <span class="br0">&#93;</span> <span class="br0">&#41;</span>
                        <span class="kw1">print</span> errorMessage
                        <span class="kw3">sys</span>.<span class="me1">exit</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span>
                <span class="kw1">else</span>:   
                        <span class="kw2">self</span>.<span class="me1">cursor</span> = <span class="kw2">self</span>.<span class="me1">db</span>.<span class="me1">cursor</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="co1">#                       self.cursor.execute(&quot;SET NAMES 'utf8'&quot;)</span>
                        <span class="kw1">return</span>
&nbsp;
        <span class="kw1">def</span> insert<span class="br0">&#40;</span><span class="kw2">self</span>,sql<span class="br0">&#41;</span>:
                <span class="kw2">self</span>.<span class="me1">cursor</span>.<span class="me1">execute</span><span class="br0">&#40;</span>sql<span class="br0">&#41;</span>
&nbsp;
        <span class="kw1">def</span> showdata<span class="br0">&#40;</span><span class="kw2">self</span>,sql<span class="br0">&#41;</span>:
                <span class="kw2">self</span>.<span class="me1">cursor</span>.<span class="me1">execute</span><span class="br0">&#40;</span>sql<span class="br0">&#41;</span>
                <span class="kw1">return</span> <span class="kw2">self</span>.<span class="me1">cursor</span>.<span class="me1">fetchall</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
&nbsp;
        <span class="kw1">def</span> <span class="kw4">__del__</span><span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:
                <span class="kw2">self</span>.<span class="me1">cursor</span>.<span class="me1">close</span>
                <span class="kw2">self</span>.<span class="me1">db</span>.<span class="me1">close</span>
&nbsp;
text = <span class="kw3">sys</span>.<span class="me1">stdin</span>.<span class="me1">read</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
db = Mydb<span class="br0">&#40;</span><span class="br0">&#41;</span>
&nbsp;
<span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span> <span class="sy0">&amp;</span>gt<span class="sy0">;</span> <span class="nu0">1</span> <span class="kw1">and</span> <span class="kw2">len</span><span class="br0">&#40;</span>text<span class="br0">&#41;</span>:
        number = <span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>
        sql = <span class="st0">'insert into outbox (number,text) VALUES (&quot;'</span> + number + <span class="st0">'&quot;,&quot;'</span> + text + <span class="st0">'&quot;)'</span>
&nbsp;
        db.<span class="me1">insert</span><span class="br0">&#40;</span>sql<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">else</span>:   
        <span class="kw1">print</span> 
        <span class="kw1">print</span> <span class="st0">&quot;    ********** outbox ********** &quot;</span>
        <span class="kw1">for</span> rs <span class="kw1">in</span> db.<span class="me1">showdata</span><span class="br0">&#40;</span><span class="st0">&quot;select * from outbox&quot;</span><span class="br0">&#41;</span>:
                <span class="kw1">print</span> rs<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>,rs<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>,rs<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span>,rs<span class="br0">&#91;</span>-<span class="nu0">7</span><span class="br0">&#93;</span>,rs<span class="br0">&#91;</span>-<span class="nu0">5</span><span class="br0">&#93;</span>
&nbsp;
        <span class="kw1">print</span> <span class="st0">&quot;    ********** inbox *********&quot;</span>
        <span class="kw1">for</span> rs2 <span class="kw1">in</span> db.<span class="me1">showdata</span><span class="br0">&#40;</span><span class="st0">&quot;select * from inbox&quot;</span><span class="br0">&#41;</span>:
                <span class="kw1">print</span> rs2<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>,rs2<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>,rs2<span class="br0">&#91;</span>-<span class="nu0">3</span><span class="br0">&#93;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/smsd-and-chinese/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>oracle 的 job 又遇到问题了</title>
		<link>http://wdicc.com/oracle-jobs/</link>
		<comments>http://wdicc.com/oracle-jobs/#comments</comments>
		<pubDate>Fri, 29 Jun 2007 02:19:24 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[job]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[高级复制]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/oracle-jobs/</guid>
		<description><![CDATA[还是高级复制的问题，这次可能是因为job执行过程中，对方机器刚好重启导致的。反正job是卡在那里了，都10多天了。 查看 dba_jobs_running 表，可以看到卡住的job的 job_id 和 sid 。查看 dba_jobs 表，可以看到相应 job 的信息，this_date 如果有数据的话，表示的是 job 开始执行的时间，next_date 是下次执行 job 的时间，如果 job 正常执行完毕，那么 this_date 应该是空的。根据 sid 还可以查看 v$session_wait 和 v$session 里面的这个 job 的一些状态。 尝试了下面的方法来重新运行job，当时好像不好用，不过今天来看的时候，job是执行了。现在也不清楚是不是我这个操作起作用了，真晕。 SQL&#38;gt; exec dbms_job.broken(109,true); &#160; PL/SQL procedure successfully completed. &#160; SQL&#38;gt; commit; &#160; Commit complete. &#160; SQL&#38;gt; select job,sid from dba_jobs_running; &#160; JOB SID ---------- [...]]]></description>
			<content:encoded><![CDATA[<p>还是高级复制的问题，这次可能是因为job执行过程中，对方机器刚好重启导致的。反正job是卡在那里了，都10多天了。</p>
<p>查看 dba_jobs_running 表，可以看到卡住的job的 job_id 和 sid 。查看 dba_jobs 表，可以看到相应 job 的信息，this_date 如果有数据的话，表示的是 job 开始执行的时间，next_date 是下次执行 job 的时间，如果 job 正常执行完毕，那么 this_date 应该是空的。根据 sid 还可以查看 v$session_wait 和 v$session 里面的这个 job 的一些状态。</p>
<p>尝试了下面的方法来重新运行job，当时好像不好用，不过今天来看的时候，job是执行了。现在也不清楚是不是我这个操作起作用了，真晕。</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="txt">SQL&amp;gt; exec dbms_job.broken(109,true);
&nbsp;
PL/SQL procedure successfully completed.
&nbsp;
SQL&amp;gt; commit;
&nbsp;
Commit complete.
&nbsp;
SQL&amp;gt; select job,sid from dba_jobs_running;
&nbsp;
       JOB        SID
---------- ----------
       109        656
&nbsp;
SQL&amp;gt; select saddr,sid,serial#,paddr,username,status from v$session where username = 'REPADMIN';
&nbsp;
SADDR           SID    SERIAL# PADDR    USERNAME                       STATUS
-------- ---------- ---------- -------- ------------------------------ --------
973CF8C4        626         27 98F96BB8 REPADMIN                       ACTIVE
973D2E7C        629         10 98F88670 REPADMIN                       ACTIVE
973F11F4        656         10 98F88174 REPADMIN                       ACTIVE
&nbsp;
SQL&amp;gt; alter system kill session '656,10';
&nbsp;
System altered.
&nbsp;
SQL&amp;gt; select saddr,sid,serial#,paddr,username,status from v$session where username = 'REPADMIN';
&nbsp;
no rows selected
&nbsp;
SQL&amp;gt; select job,sid from dba_jobs_running;
&nbsp;
no rows selected
&nbsp;
SQL&amp;gt; select job,log_user,last_date,next_date from dba_jobs where log_user='REPADMIN';
&nbsp;
       JOB LOG_USER                       LAST_DATE
---------- ------------------------------ -------------------
NEXT_DATE
-------------------
       106 REPADMIN                       2007-06-28 16:25:43
2007-06-28 16:35:43
&nbsp;
       109 REPADMIN                       2007-06-28 16:07:38
4000-01-01 00:00:00
&nbsp;
       110 REPADMIN                       2007-06-28 16:25:43
2007-06-28 16:35:43
&nbsp;
&nbsp;
SQL&amp;gt; exec dbms_job.broken(109,false,sysdate);
&nbsp;
PL/SQL procedure successfully completed.
&nbsp;
SQL&amp;gt; commit;
&nbsp;
Commit complete.
&nbsp;
SQL&amp;gt; select job,log_user,last_date,next_date from dba_jobs where log_user='REPADMIN';
&nbsp;
       JOB LOG_USER                       LAST_DATE
---------- ------------------------------ -------------------
NEXT_DATE
-------------------
       106 REPADMIN                       2007-06-28 16:25:43
2007-06-28 16:35:43
&nbsp;
       109 REPADMIN                       2007-06-28 16:07:38
2007-06-28 16:28:40
&nbsp;
       110 REPADMIN                       2007-06-28 16:25:43
2007-06-28 16:35:43</pre></div></div>

<p>此后就我所知道的，就只能等着了。dbms_job.run(job_id) 也可以让 job 立即执行。关键是看 this_date ，他的值就是开始执行 job 的时间，job 如果执行时间太长，而下次执行又太快的话，可能也会导致问题。所以还可以尝试手动执行 job 看看。 dba_jobs 的 waht 字段就是对于的语句。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/oracle-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>稍微深入了解了一下cacti的thold插件的邮件通知</title>
		<link>http://wdicc.com/change-trigger-setting-for-thold/</link>
		<comments>http://wdicc.com/change-trigger-setting-for-thold/#comments</comments>
		<pubDate>Thu, 28 Jun 2007 06:06:08 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[thold]]></category>
		<category><![CDATA[trigger]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/change-trigger-setting-for-thold/</guid>
		<description><![CDATA[通过cacti的thold插件，可以做到snmp抓取到的数值低于你规定的值的时候进行邮件通知，例如我用他来监控磁盘空间，当磁盘空间低于某个数的时候就会给指定的email发邮件。但是有一点郁闷的是，有时候，可能是由于网络原因，抓取会超时，这样就会导致触发trigger，给你发送邮件。5分钟抓取一次，我这里的情况是几乎每个小时总会有2，3封这种邮件，很烦人，而且根本没意义。早就想屏蔽掉这种情况了，看了代码挺复杂就懒得弄，今天实在受不了了，深入了解了一下。 其实thold本身已经考虑到了这种情况，在 thold 的设置里面，就有一项 Default Trigger Count （Number of consecutive times the data source must be in breach of the threshold for an alert to be raised），就是连续触发几次才认为他真的低于 thold 了，才发送邮件。我尝试过修改这个设置，发现不管用。看了代码才了解，每个 Thresholds&#160;都有自己的 trigger 值，那个 default trigger count 只对新建的 thresholds 才有用。所以针对现有的，需要逐个去修改才行。如果不设置这个选项，那么使用的就是上面设置的那个默认的，所以没特殊需要，还是不要针对每个 thresholds 设置自己的 trigger 值比较好，这样方便修改。我通过修改数据库的方法，直接把这些都修改了。 UPDATE thold_data SET thold_fail_trigger = NULL; 修改了之后还没有收到，这下应该清净了吧？]]></description>
			<content:encoded><![CDATA[<p>通过cacti的thold插件，可以做到snmp抓取到的数值低于你规定的值的时候进行邮件通知，例如我用他来监控磁盘空间，当磁盘空间低于某个数的时候就会给指定的email发邮件。但是有一点郁闷的是，有时候，可能是由于网络原因，抓取会超时，这样就会导致触发trigger，给你发送邮件。5分钟抓取一次，我这里的情况是几乎每个小时总会有2，3封这种邮件，很烦人，而且根本没意义。早就想屏蔽掉这种情况了，看了代码挺复杂就懒得弄，今天实在受不了了，深入了解了一下。</p>
<p>其实thold本身已经考虑到了这种情况，在 thold 的设置里面，就有一项 Default Trigger Count （Number of consecutive times the data source must be in breach of the threshold for an alert to be raised），就是连续触发几次才认为他真的低于 thold 了，才发送邮件。我尝试过修改这个设置，发现不管用。看了代码才了解，每个 <strong>Thresholds</strong>&nbsp;都有自己的 trigger 值，那个 default trigger count 只对新建的 thresholds 才有用。所以针对现有的，需要逐个去修改才行。如果不设置这个选项，那么使用的就是上面设置的那个默认的，所以没特殊需要，还是不要针对每个 thresholds 设置自己的 trigger 值比较好，这样方便修改。我通过修改数据库的方法，直接把这些都修改了。</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="sql"><span class="kw1">UPDATE</span> thold_data <span class="kw1">SET</span> thold_fail_trigger <span class="sy0">=</span> <span class="kw1">NULL</span>;</pre></div></div>

<p>修改了之后还没有收到，这下应该清净了吧？</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/change-trigger-setting-for-thold/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>为resin配置oracle连接池</title>
		<link>http://wdicc.com/resin-and-oracle/</link>
		<comments>http://wdicc.com/resin-and-oracle/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 06:44:36 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[resin]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/resin-and-oracle/</guid>
		<description><![CDATA[resin 2.x 的配置方法和 3.x 的方法有区别。按照官方文档，做下面的配置。 &#60;database&#62; &#60;jndi-name&#62;oraPool&#60;/jndi-name&#62; &#60;driver&#62; &#60;type&#62;oracle.jdbc.pool.OracleConnectionPoolDataSource&#60;/type&#62; &#60;url&#62;jdbc:oracle:thin:@localhost:1521:dbname&#60;/url&#62; &#60;user&#62;username&#60;/user&#62; &#60;password&#62;password&#60;/password&#62; &#60;/driver&#62; #.... &#60;/database&#62; &#160;在上面的 &#8230;. 这里还可以添加其他的配置信息。配置好之后启动resin，会发现提示类似下面的信息。 conf/resin.conf:218: java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleConnectionPoolDataSource 提示没有找到连接oracle数据库的jdbc驱动。这个驱动在oracle的安装目录里面有。比如我这里是在 /db/oracle/10.1.0/product/10g/jdbc/lib/ 。里面好多文件，具体都什么作用可以看这里。 复制这个目录里面的 classes12.jar 和 nls_charset12.jar 到resin的 lib 目录下面，重新启动 resin 就可以了。本文完成过程中参考了这篇文章。如何使用这个pool，官方文档也有说明。]]></description>
			<content:encoded><![CDATA[<p>resin 2.x 的配置方法和 3.x 的方法有区别。按照<a href="http://www.caucho.com/resin-3.1/doc/db-thirdparty.xtp">官方文档</a>，做下面的配置。</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="txt">&lt;database&gt;
  &lt;jndi-name&gt;oraPool&lt;/jndi-name&gt;
  &lt;driver&gt;
    &lt;type&gt;oracle.jdbc.pool.OracleConnectionPoolDataSource&lt;/type&gt;
    &lt;url&gt;jdbc:oracle:thin:@localhost:1521:dbname&lt;/url&gt;
    &lt;user&gt;username&lt;/user&gt;
    &lt;password&gt;password&lt;/password&gt;
  &lt;/driver&gt;
#....
&lt;/database&gt;</pre></div></div>

<p>&nbsp;在上面的 <font color="#ff0000">&#8230;. </font>这里还可以添加<a href="http://www.caucho.com/resin-3.1/doc/database-tags.xtp">其他的</a>配置信息。配置好之后启动resin，会发现提示类似下面的信息。</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="txt">conf/resin.conf:218: java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleConnectionPoolDataSource</pre></div></div>

<p>提示没有找到连接oracle数据库的jdbc驱动。这个驱动在oracle的安装目录里面有。比如我这里是在 /db/oracle/10.1.0/product/10g/jdbc/lib/ 。里面好多文件，具体都什么作用可以看<a href="http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#02_07">这里</a>。</p>
<p>复制这个目录里面的 classes12.jar 和 nls_charset12.jar 到resin的 lib 目录下面，重新启动 resin 就可以了。本文完成过程中参考了<a href="http://dev.csdn.net/article/29/29762.shtm">这篇</a>文章。如何使用这个pool，官方文档也有<a href="http://www.caucho.com/resin-3.1/doc/config-database.xtp#usage/lookup">说明</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/resin-and-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>resin 的安装步骤</title>
		<link>http://wdicc.com/install-resin/</link>
		<comments>http://wdicc.com/install-resin/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 08:15:46 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[resin]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/install-resin/</guid>
		<description><![CDATA[resin目前已经到了3.1版本，从resin网站上面下载的resin不带jdk，需要自己去下载。resin的下载页面在这里。下载最新的 Resin Pro 3.1.1 版本。 jdk的下载地址在 这里&#160;，resin 3.1需要1.5及以上版本的jdk。 先来安装resin： tar zxvf resin-pro-3.1.1 cd resin-pro-3.1.1 ./configure --prefix=/usr/local/resin #安装的目的地址 make &#38;amp;&#38;amp; make install 安装完resin之后，安装jdk： cd /usr/local chmod +x /root/jdk-6u1-linux-i586.bin /root/jdk-6u1-linux-i586.bin 此后会在/usr/local/下面建立一个jdk1.6.0_01目录，jdk就安装完毕了。 resin 的配置文件在 /usr/loca/resin/conf 下面，主要是 resin.conf 。默认的端口是8080。 &#60;http port=&#34;8080&#34; address=&#34;*&#34;&#62; 然后就是添加自己的应用地址了。 &#60;host id=&#34;&#34; root-directory=&#34;.&#34;&#62; &#60;web-app id=&#34;/&#34; root-directory=&#34;webapps/ROOT&#34;&#62; 在这下面添加一行 &#60;web-app id=&#34;/test&#34; root-directory=&#34;/www/test/&#34;&#62; 此后呢，访问 http://ip:8080/test 就可以访问到你的应用了。]]></description>
			<content:encoded><![CDATA[<p>resin目前已经到了3.1版本，从resin网站上面下载的resin不带jdk，需要自己去下载。resin的下载页面在<a href="http://www.caucho.com/download/index.xtp">这里</a>。下载最新的 Resin Pro 3.1.1 版本。</p>
<p>jdk的下载地址在 <a href="http://java.sun.com/javase/downloads/index.jsp">这里</a>&nbsp;，resin 3.1需要1.5及以上版本的jdk。</p>
<p>先来安装resin：</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash"><span class="kw2">tar</span> zxvf resin-pro-3.1.1
<span class="kw3">cd</span> resin-pro-3.1.1
.<span class="sy0">/</span>configure <span class="re5">--prefix</span>=<span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>resin <span class="co0">#安装的目的地址</span>
<span class="kw2">make</span> <span class="sy0">&amp;</span>amp;<span class="sy0">&amp;</span>amp; <span class="kw2">make</span> <span class="kw2">install</span></pre></div></div>

<p>安装完resin之后，安装jdk：</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash"><span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span><span class="kw3">local</span>
<span class="kw2">chmod</span> +x <span class="sy0">/</span>root<span class="sy0">/</span>jdk-6u1-linux-i586.bin
<span class="sy0">/</span>root<span class="sy0">/</span>jdk-6u1-linux-i586.bin</pre></div></div>

<p>此后会在/usr/local/下面建立一个jdk1.6.0_01目录，jdk就安装完毕了。</p>
<p>resin 的配置文件在 /usr/loca/resin/conf 下面，主要是 resin.conf 。默认的端口是8080。</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="txt">&lt;http port=&quot;8080&quot; address=&quot;*&quot;&gt;</pre></div></div>

</p>
<p>然后就是添加自己的应用地址了。</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="txt">&lt;host id=&quot;&quot; root-directory=&quot;.&quot;&gt;
      &lt;web-app id=&quot;/&quot; root-directory=&quot;webapps/ROOT&quot;&gt;</pre></div></div>

</p>
<p>在这下面添加一行</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="txt">&lt;web-app id=&quot;/test&quot; root-directory=&quot;/www/test/&quot;&gt;</pre></div></div>

</p>
<p>此后呢，访问 http://ip:8080/test 就可以访问到你的应用了。 </p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/install-resin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux tuning</title>
		<link>http://wdicc.com/linux-tuning/</link>
		<comments>http://wdicc.com/linux-tuning/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 01:47:22 +0000</pubDate>
		<dc:creator>wd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://blog.wdicc.com/wordpress/2007/06/04/337/</guid>
		<description><![CDATA[地址 http://www.enigma.id.au/linux_tuning.txt # Linux kernel tweaking for performance and security on a busy Linux # server with a decent amount of memory. # # This file should be saved as /etc/sysctl.conf # You can source it manually if your system has booted by using: # sysctl -e -p /etc/sysctl.conf # # Paul Day, paul (at) [...]]]></description>
			<content:encoded><![CDATA[<p>地址 <a href="http://www.enigma.id.au/linux_tuning.txt">http://www.enigma.id.au/linux_tuning.txt</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span class="co0"># Linux kernel tweaking for performance and security on a busy Linux</span>
<span class="co0"># server with a decent amount of memory.</span>
<span class="co0">#</span>
<span class="co0"># This file should be saved as /etc/sysctl.conf</span>
<span class="co0"># You can source it manually if your system has booted by using:</span>
<span class="co0"># sysctl -e -p /etc/sysctl.conf</span>
<span class="co0">#</span>
<span class="co0"># Paul Day, paul (at) bur.st</span>
<span class="co0">#</span>
<span class="co0"># Last updated 02/03/05 and tested on 2.6.9</span>
<span class="co0">#</span>
&nbsp;
<span class="co0"># Increase RPC slots</span>
sunrpc.tcp_slot_table_entries = <span class="nu0">32</span>
sunrpc.udp_slot_table_entries = <span class="nu0">32</span>
<span class="co0"># Increase size of RPC datagram queue length</span>
net.unix.max_dgram_qlen = <span class="nu0">50</span>
<span class="co0"># Log spoofed, source routed and redirects</span>
net.ipv4.conf.default.log_martians = <span class="nu0">1</span>
<span class="co0"># Don't accept source routes</span>
net.ipv4.conf.default.accept_source_route = <span class="nu0">0</span>
<span class="co0"># Don't send redirects</span>
net.ipv4.conf.default.send_redirects = <span class="nu0">0</span>
<span class="co0"># Source route verification on - incoming packets must match outgoing routing</span>
net.ipv4.conf.default.rp_filter = <span class="nu0">1</span>
<span class="co0"># Don't accept redirects</span>
net.ipv4.conf.default.accept_redirects = <span class="nu0">0</span>
<span class="co0"># Don't forward source routes</span>
net.ipv4.conf.default.mc_forwarding = <span class="nu0">0</span>
<span class="co0"># Disable forwarding </span>
net.ipv4.conf.default.forwarding = <span class="nu0">0</span>
<span class="co0"># Log spoofed, source routed and redirects</span>
net.ipv4.conf.all.log_martians = <span class="nu0">1</span>
<span class="co0"># Don't relay bootp</span>
net.ipv4.conf.all.bootp_relay = <span class="nu0">0</span>
<span class="co0"># Don't proxy arp for anyone</span>
net.ipv4.conf.all.proxy_arp = <span class="nu0">0</span>
<span class="co0"># Don't accept source route packets</span>
net.ipv4.conf.all.accept_source_route = <span class="nu0">0</span>
<span class="co0"># Don't send redirects</span>
net.ipv4.conf.all.send_redirects = <span class="nu0">0</span>
<span class="co0"># Source route verification on - incoming packets must match outgoing routing</span>
net.ipv4.conf.all.rp_filter = <span class="nu0">1</span>
<span class="co0"># Don't accept redirects</span>
net.ipv4.conf.all.accept_redirects = <span class="nu0">0</span>
<span class="co0"># Don't forward source routes</span>
net.ipv4.conf.all.mc_forwarding = <span class="nu0">0</span>
<span class="co0"># Don't enable forwarding</span>
net.ipv4.conf.all.forwarding = <span class="nu0">0</span>
<span class="co0"># Don't allow the arp table to become bigger than this</span>
net.ipv4.neigh.default.gc_thresh3 = <span class="nu0">2048</span>
<span class="co0"># Tell the gc when to become aggressive with arp table cleaning.</span>
<span class="co0"># Adjust this based on size of the LAN. 256 is suitable for most</span>
net.ipv4.neigh.default.gc_thresh2 = <span class="nu0">1024</span>
<span class="co0"># Adjust where the gc will leave arp table alone - set to 32.</span>
net.ipv4.neigh.default.gc_thresh1 = <span class="nu0">32</span>
<span class="co0"># Adjust to arp table gc to clean-up more often</span>
net.ipv4.neigh.default.gc_interval = <span class="nu0">30</span>
<span class="co0"># Increase TCP</span>
net.ipv4.neigh.default.proxy_qlen = <span class="nu0">96</span>
net.ipv4.neigh.default.unres_qlen = <span class="nu0">6</span>
<span class="co0"># Increase size of socket buffers</span>
net.ipv4.tcp_rmem = <span class="nu0">4096</span>	<span class="nu0">98304</span>	<span class="nu0">349520</span>
net.ipv4.tcp_wmem = <span class="nu0">4096</span>	<span class="nu0">65535</span>	<span class="nu0">262142</span>
net.ipv4.tcp_mem = <span class="nu0">98304</span>	<span class="nu0">262142</span>	<span class="nu0">393216</span>
<span class="co0"># Turn off sack</span>
net.ipv4.tcp_dsack = <span class="nu0">0</span>
<span class="co0"># Don't use ECN because too many sites have wacky routers that can't handle it`</span>
net.ipv4.tcp_ecn = <span class="nu0">0</span>
net.ipv4.tcp_reordering = <span class="nu0">3</span>
<span class="co0"># Turn off sack/fack</span>
net.ipv4.tcp_fack = <span class="nu0">0</span>
<span class="co0"># Enable bad error message Protection</span>
net.ipv4.icmp_ignore_bogus_error_responses = <span class="nu0">1</span>
<span class="co0"># Ignore broadcasts pings, could become part of a Smurf</span>
net.ipv4.icmp_echo_ignore_broadcasts = <span class="nu0">1</span>
<span class="co0"># But don't ignore directed pings</span>
net.ipv4.icmp_echo_ignore_all = <span class="nu0">0</span>
<span class="co0"># Widen local port range</span>
net.ipv4.ip_local_port_range = <span class="nu0">33000</span>	<span class="nu0">60000</span>
<span class="co0"># Bump up TCP socket queuer to help with syn floods</span>
net.ipv4.tcp_max_syn_backlog = <span class="nu0">2048</span>
<span class="co0"># Turn syn-cookie protection on</span>
net.ipv4.tcp_syncookies = <span class="nu0">1</span>
<span class="co0"># Drop it so lack of FIN times out quicker</span>
net.ipv4.tcp_fin_timeout = <span class="nu0">30</span>
<span class="co0"># How many times to retry killing an alive TCP connection</span>
net.ipv4.tcp_retries2 = <span class="nu0">15</span>
net.ipv4.tcp_retries1 = <span class="nu0">3</span>
<span class="co0"># Enable a fix for RFC1337 - time-wait assassination hazards in TCP</span>
net.ipv4.tcp_rfc1337 = <span class="nu0">1</span>
<span class="co0"># Drop keep-alive time</span>
net.ipv4.tcp_keepalive_time = <span class="nu0">3600</span>
<span class="co0"># Set number of times to retry a SYN-ACK in a half-open new connections</span>
net.ipv4.tcp_synack_retries = <span class="nu0">5</span>
<span class="co0"># Set number of times to retry SYN in a new connection</span>
net.ipv4.tcp_syn_retries = <span class="nu0">5</span>
<span class="co0"># Turn off sack</span>
net.ipv4.tcp_sack = <span class="nu0">0</span>
<span class="co0"># Enable really big (&gt;65kB) TCP window scaling if we want it.</span>
net.ipv4.tcp_window_scaling = <span class="nu0">1</span>
<span class="co0"># Turn off timestamps</span>
<span class="co0"># Turn this back on if you're on a gigabit or very busy network</span>
<span class="co0"># Having it off is one less thing the IP stack needs to work on</span>
net.ipv4.tcp_timestamps = <span class="nu0">0</span>
<span class="co0"># Increase number of incoming connections backlog</span>
net.core.somaxconn = <span class="nu0">512</span>
<span class="co0"># Bump optmem_max up</span>
net.core.optmem_max = <span class="nu0">20480</span>
<span class="co0"># Increase number of incoming connections backlog</span>
net.core.netdev_max_backlog = <span class="nu0">1024</span>
net.core.dev_weight = <span class="nu0">64</span>
<span class="co0"># Bump up default r/wmem to max</span>
net.core.rmem_default = <span class="nu0">262141</span>
net.core.wmem_default = <span class="nu0">262141</span>
<span class="co0"># Bump up max r/wmem</span>
net.core.rmem_max = <span class="nu0">262141</span>
net.core.wmem_max = <span class="nu0">262141</span>
<span class="co0"># Increase size of file handles and inode cache</span>
fs.file-max = <span class="nu0">209708</span></pre></div></div>

<p class="poweredbyperformancing">Powered by <a href="http://scribefire.com/">ScribeFire</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wdicc.com/linux-tuning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

