程序员…
19 Aug
If your running Munin in WHM they you may have noticed the passive netstat connections have been rising steadily over the last couple of weeks. This isn’t a problem with your server, its a Munin bug that can be easily fixed.

Apparently the problem stemms from Munin counting the passive connections rejected. You can fix this problem quite easily by following the instructions below
Edit the following file:
/usr/share/munin/plugins/netstat
and change the line
ref:
http://markmaunder.com/2008/how-to-fix-munins-netstat-passive-connections-increasing-constantly/
http://www.silverark.co.uk/knowledge/hosting/fix-the-passive-netstat-connections-in-munin
2 Jun
MD5算法常常被用来验证网络文件传输的完整性,防止文件被人篡改。MD5 全称是报文摘要算法(Message-Digest Algorithm 5),此算法对任意长度的信息逐位进行计算,产生一个二进制长度为128位(十六进制长度就是32位)的“指纹”(或称“报文摘要”),不同的文件产生相同的报文摘要的可能性是非常非常之小的。
在linux或Unix上,md5sum是用来计算和校验文件报文摘要的工具程序。一般来说,安装了Linux后,就会有md5sum这个工具,直接在命令行终端直接运行。
1、使用md5sum来产生指纹(报文摘要)命令如下:
md5sum filename > filename.md5
或者
md5sum filename >>filename.md5
示例:
[www@iceskysl 20100527]$ md5sum update.zip.1
cd32d060d5e4d1891dfa4d6552cc57bb update.zip.1
也可以把多个文件的报文摘要输出到一个md5文件中,这要使用通配符*,比如某目录下有几个iso文件,要把这几个iso文件的摘要输出到iso.md5文件中,命令如下:
md5sum *.iso > iso.md5
2、使用md5报文摘要验证文件,方法有二:
把下载的文件file和该文件的file.md5报文摘要文件放在同一个目录下,然后用如下命令进行验证:
md5sum -c file.md5
然后如果验证成功,则会输出:正确
1 Apr
昨晚看hero的时候顺带update到mac OS 10.6.3,早上重启机器安装成功,发现rails3无法启动,报:
/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path’: can’t find executable rails for rails-3.0.0.beta (Gem::Exception)
from /usr/bin/rails:19
这个错误我之前安装rails3的时候遇到过,解决如下:
1.先尝试下重新安装rails
IceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install rails –pre
Password:
Successfully installed treetop-1.4.5
1 gem installed
Installing ri documentation for treetop-1.4.5…
Installing RDoc documentation for treetop-1.4.5..
发现多了个treetop的gem,查查是啥:
Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionarily ease.
再次执行rails,发现
/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path’: can’t find executable rails for rails-3.0.0.beta (Gem::Exception)
from /usr/bin/rails:19
还是不行,那就是railties的问题了,重新装下
IceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ sudo gem install railties –pre
Successfully installed railties-3.0.0.beta
1 gem installed
Installing ri documentation for railties-3.0.0.beta…
Installing RDoc documentation for railties-3.0.0.beta…
IceskYsl@eoe /svnroot/eoe/dev/rails/eoelogs $ rails -v
Rails 3.0.0.beta
OK,可以了~
31 Mar
很简单,就是在.bash_profile下加了三行.
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
另外加了一行个性化提示符.
export PS1=”\[\e[32;1;40m\]\u@\H \w \$ \[\e[0m\]”
相关的文章参见:
http://mac.linsheng.me/archives/530.html
http://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip01/
http://hi.baidu.com/rainfish_tju/blog/item/0f54458f849141f0513d9284.html
配置
那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。
~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。
alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。
CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
LSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:
directory
symbolic link
socket
pipe
executable
block special
character special
executable with setuid bit set
executable with setgid bit set
directory writable to others, with sticky bit
directory writable to others, without sticky bit
LSCOLORS中,字母代表的颜色如下:
a 黑色
b 红色
c 绿色
d 棕色
e 蓝色
f 洋红色
g 青色
h 浅灰色
A 黑色粗体
B 红色粗体
C 绿色粗体
D 棕色粗体
E 蓝色粗体
F 洋红色粗体
G 青色粗体
H 浅灰色粗体
x 系统默认颜色
所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了
5 Feb
如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
可以从这里下载 http://visor.binaryage.com/
这个软件需要SIMBL ,如果你没有安装,要先安装这个。
http://www.culater.net/software/SIMBL/SIMBL.php
SIMBL (SIMple Bundle Loader) – pronounced like “symbol” or “cymbal” – enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
visor: http://visor.binaryage.com/
Installation
Install SIMBL and make sure you have latest SIMBL 0.9.x
Place Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
Relaunch Terminal.app – You should now see the Visor Status Menu Item
Configure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences … and edit your keyboard hot-key
You can now trigger Visor with your hot-key from any application to get an instant terminal session.To hide Visor, you can either:
re-trigger with your key-combo
optionally you can click off of the Visor window
30 Jan
抓哪个进程干坏事前要先停掉syslog
/etc/init.d/rsyslog stop
echo 1 > /proc/sys/vm/block_dump
dmesg | egrep “READ|WRITE|dirtied” | egrep -o ‘([a-zA-Z]*)’ | sort | uniq -c | sort -rn | head
1423 kjournald
1075 pdflush
209 indexer
3 cronolog
1 rnald
1 mysqld
不要忘记在抓完之后关掉block_dump和启动syslog
echo 0 > /proc/sys/vm/block_dump
/etc/init.d/rsyslog start
21 Jan
Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.
Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.
Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.
So, if:
M = Amount of RAM in GB, and S = Amount of swap in GB, then
If M < 2
S = M *2
Else
S = M + 2
Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.
For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).
source:http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-swapspace.html
20 Jan
Does this error message look familar when you script/console?
[iceskysl@li1248 current]$ ./script/console production
Loading production environment (Rails 2.3.5)
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
from /usr/local/lib/ruby/1.8/irb/completion.rb:10
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require'
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each'
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/local/bin/irb:13
this happens when readline is somehow different than your current version of ruby or corrupted. The quick fix is to recompile readline. To do it in CentOS with yum:
$> yum install readline-devel -y
$> cd /root/src/ruby-1.8.6-p114/ext/readline/
$> ruby extconf.rb
$> make
$> sudo make install
Now you should have script/console working.
13 Jan
I am in the process of building my blog using wordpress ,then i install SI CAPTCHA Anti-Spam ,but it’s say i didn’t have GD support for PHP5 installed on my server. so i need to do:
Open terminal and type in the following command:
$ sudo apt-get install php5-gd
Now restart Apache
# sudo /etc/init.d/apache2 restart
or restart spawn-fcgi
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
There you go, you now have GD Support for PHP5 in Ubuntu. Get your Drupal on!
13 Jan
由于这个blog用的是wordpress,需要在VPS上搭一套PHP的环境,以前折腾过,倒也不费事,最后用spawn-fcgi来跑,记录一条如下
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u www-data -g www-data -f /usr/bin/php-cgi -C 10
然后修改下php.ini的upload_max_filesize,就差不多OK了~
Comments::最新评论