Archive

Posts Tagged ‘Linux’

“Resource temporarily unavailable” on the whm host

April 4th, 2009

Today, following a document to tune the security of our whm hosting, I enabled “Shell fork bomb protection” in “Security Center”. But I’m 100% sure what I did. Then when I try to run the apache process of the user, the exception “bash: fork Resource temporarily unavailable” raised. It took me a lot of time to find why this happen. Finally I got this document: http://www.eddieoneverything.com/linux/linux-whm-cpanel-resource-temporarily-unavailable.php

It’s because “Shell fork bomb protection” will enable the limitation for each user, the limitation is defined with ulimit command. The default limitation is 100 open files with 20 processes.

Linux

分析日志常用到的几个shell工具

March 31st, 2009

一个不错的例子: http://nunojob.wordpress.com/2008/04/12/history-awk-print-2-sort-uniq-c-sort-rn-head/

httpd.log | awk '{print $2}' \  | sort | uniq -c | sort -rn | head

解释:
httpd.log : 要分析的日志
awk : 用来取出某一特定的列。简单的也可以用cut来代替
sort : 用来排序(第一次排序是用来为后面的uniq服务的。uniq对于没有排序的内容工作不正确)
uniq : 用来uniq有序的内容,-c参数会把重复次数带上
sort -rn : 用来安重复次数倒序排列
head : 用来去前几条数据,默认是10.

Python ,

Convert MP3 Id3 tag encoding

March 12th, 2009

It’s a long time pain for my mp3 files. I tried a lot of kinds way to convert my mp3 files’ id3 tag encoding. But every time when I need to convert the tag, I can’t remembered what I did last time. Now I’m going to record some way to do this.

I used amarok. Since the developers os amarok hate to deal with various kinds of encoding, they determined to use unicode which required id3v2.4 tag. This decision makes a lot of Chinese music displayed like a mess in the amarok because most of Chinese music used old version, different encode id3 tags.

I found some good ways to convert your music id3 tags here: http://wiki.linuxmce.org/index.php/Converting_MP3_Tags_To_UTF-8

The most way I like is mid3iconv

I used it like this:

For a single file

$mid3iconv -e gb2312 a.mp3 --remove-v1 -dp

For a directory

$find . -name "*.mp3" -exec mid3iconv -e gb2312 --remove-v1 -dp "{}" \;

-p option means dry-run, so if you really want to convert, remove this option.

Linux , ,

FireStats icon Powered by FireStats