Thursday, November 12th, 2009 at 6:19 pm
最近写一个脚本,需要直接在linux文本终端里面直接发送附件,而linux自带的那个什么mail命令,是由mailx包生成的,本身不带发送附件的功能。
放狗搜了一圈,发现基本上使用的都是mailx+uuencode这招。详情见http://www.webjx.com/server/linux-2724.html”
但是这种方式,是将文件转成ASCII码进行传输,在某些客户端(比如某些web客户端),很可能收到的就是一堆乱码。为了解决这个问题,我推荐另一个文本模式的邮件客户端:nail
不知道centos的官方源中有没有,但是,在rpmforge的源里面是肯定有的。装好之后,本身只会生成/usr/bin/nail这个命令,要是你很习惯用mail这个命令的话,可以考虑自己建立一个软链。
另附rpmforge源中nail包的information
# yum info nail
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.ustc.edu.cn
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* rpmforge: ftp-stud.fht-esslingen.de
* updates: centos.ustc.edu.cn
Installed Packages
Name : nail
Arch : x86_64
Version : 12.3
Release : 4.el5.rf
Size : 612 k
Repo : installed
Summary : Enhanced implementation of the mailx command
URL : http://nail.sourceforge.net/
License : BSD
Description: Nail is an enhanced mail command, which provides the functionality
: of the POSIX mailx command. It is derived from Berkeley Mail.
:
: Additionally to the POSIX features, nail can work with Maildir/ e-mail
: storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
: procotols (including over SSL) to operate with remote hosts, handles mime
: types and different charsets. There are a lot of other useful features,
: see nail.html in the documentation.
:
: And as its ancient analogues, nail can be used as a mail script language,
: both for sending and receiving mail.
myhnet
Linux
attach, attachment, consol, 邮件, 附件, Linux, mail, mail with attachment, mailx, nail, terminal, uuencode, 带附件的Email, 带附件邮件, 文本模式
Monday, November 9th, 2009 at 7:11 pm
虽然很早以前就知道得用apche的mod_proxy可以用来做负载均衡,可由于太懒,一直都没有去做。今天刚好工作上也要做这个,所以就实验了一把。
要使用apache的负载均衡功能,首得得开启下面这几个模块:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
其中mod_proxy提供代理服务器功能,mod_proxy_balancer提供负载均衡功能, mod_proxy_http让代理服务器能支持HTTP协议。
然后,要在httpd.conf中加入这么一段配置:
ProxyRequests Off
<Proxy balancer://mycluster>
BalancerMember http://192.168.0.1
BalancerMember http://192.168.0.2
</Proxy>
ProxyPass /mycluster !
ProxyPass / balancer://mycluster
<Location /mycluster>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from localhost
</Location>
从上面的 ProxyRequests Off 这条可以看出,实际上负载均衡器就是一个反向代理, 只不过它的代理转发地址不是某台具体的服务器,而是一个 balancer:// 协议:
ProxyPass / balancer://mycluster
下面那段是用来监视负载均衡的工作情况的,然后访问 http://localhost/mycluster/ 即可看到负载均衡的工作状况。你也可以利用这个工具将其中某一个终端要暂时从集群中移出,或者临时修改某个终端的参数(如factor等)。
这个地方要特别注意的是下面这行配置:
如果没有这行配置,当你访问http://localhost/mycluster/也会被转发到终端上去。
改完之后重启服务器,访问你的Apache所在服务器的地址,即可看到负载均衡的效果了。 打开 mycluster的界面,可以看到请求是平均分配的。
当然,你也可以像我这个配置这样修改其中的某些参数,来获得最大的负载均衡的功效
ProxyRequests Off
ProxyPass /mycluster !
ProxyPass / balancer://mycluster/ stickysession=BALANCEID
ProxyPassReverse / http://192.168.0.1/
ProxyPassReverse / http://192.168.0.2/
<Proxy balancer://mycluster>
BalancerMember http://192.168.0.1 route=http1 loadfactor=7
BalancerMember http://192.168.0.2 route=http2 loadfactor=3
ProxySet lbmethod=byrequests
</Proxy>
<Location /mycluster>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from localhost
</Location>
其中,stickysession=BALANCEID设置根据下面的route=http1/2来进行session的绑定。因为很多网站的变量,如登陆信息等,可能是储存在服务器端的内存中的,如果不设置这个变量,用户来访问是还是不段的在不同的终端之间切换,用户就会不停的退出
loadfactor=7这个是设置不同的终端的负载均衡的权重,数值越来,转发的数量就越多。
而ProxySet lbmethod=byrequests是用来设置负载均衡的算法。通常有三种取值:byrequests(按照请求次数均衡,默认值),bytraffic(按照流量均衡),bybusyness(按照繁忙程度均衡)。
Monday, November 9th, 2009 at 9:28 am
本来说10月底交房,搞到现在还没有交房
一个小问题到现在还没解决。。。
千比较万比较,最后还是找了一家装修公司来装
以后会省不少事情
可惜钱现在就开始超支了
只是半包,家装公司就已经收了3W多
买瓷片,厨柜,又花了几1W了
到时候还有吊顶,五金,灯饰等等又是不少的花费啊
Friday, November 6th, 2009 at 8:11 pm
anyway,生平第二个认证,也是第一个网络方面的认证算拿到手了
JNCIA-ER
Juniper Networks Certified Internet Associate, ER
Monday, November 2nd, 2009 at 6:45 pm
ubuntu910出来也有好几天了,一直没有时间更新,今天下定决定,总算更新了。
千难万苦,不过总算都弄出来了。
Q1,更新到910后,系统变得超级慢,Xorg的利用率总是高达99%。
A1,
原因:这个估计跟我的一样,在升级内核的时候,选择了保留原来的menu.lst。这样子,系统在升级的时候,并没有把最新的,910用的kernel添加到menu.lst中(虽然已经安装了),而直接把原来的内核重新生成initrd.img。
解决办法:在menu.lst中的
## ## End Default Options ##
文字后面添加如下的内容
title Ubuntu 9.04, kernel 2.6.31-14-generic
uuid 0ee48f22-2bf9-469b-83e1-0429a18cc373
kernel /vmlinuz-2.6.31-14-generic root=/dev/mapper/vg0-lv00 ro rescue quiet splash
initrd /initrd.img-2.6.31-14-generic
quiet
title Ubuntu 9.04, kernel 2.6.31-14-generic (recovery mode)
uuid 0ee48f22-2bf9-469b-83e1-0429a18cc373
kernel /vmlinuz-2.6.31-14-generic root=/dev/mapper/vg0-lv00 ro rescue single
initrd /initrd.img-2.6.31-14-generic
其中,2.6.31-14是你安装的最新的内核版本号
Q2: 我的SCIM输入法中不能添加中文了
A1:
原因:看了一些文档,好像910中的输入法已经开始主推ibus了,所以scim的支持不是很好
解决:最直接的办法是把“system”-“administration”-“Language Support”中,将“keyboard input method system”改为ibus,然后重装一个中文语文包的支持,然后将/etc/X11/xinit/xinput.d/default文件用/etc/X11/xinit/xinput.d/ibus代替,重启X服务即可。
当然,如果也可以继续用scim,只要安装一个scim-tables-zh就可以了
sudo apt-get install scim-tables-zh
然后,把/etc/X11/xinit/xinput.d/default文件用/etc/X11/xinit/xinput.d/scim代替,重启X服务即可
Q3:qq for linux在910下经常自动死掉
A3:
原因:简单的搜了一下,QQ的不稳定是因为与ibus不兼容。
解决:在Q2里面,用第二种方法解决输入法的问题就可以了
myhnet
Linux
910, 输入法, ibus, kernel, Linux, QQ, QQ老死, QQ不稳定, scim, ubuntu, ubuntu910, xorg, xorg负荷很高, 很慢, 中文输入法, 五笔