2009年4月 归档

进程打开文件数目限制

| 暂无评论 | 暂无引用通告
单进程打开文件数上限设置
编缉文件/etc/security/limits.conf

* - nofile 65536

此文件还可以对特定的用户进行限制

如果在/etc/rc.local中运行程序,涉及到文件数的限制
在运行命令前添加:

ulimit -SHn 65536

查看单进程打开文件数上限:

ulimit -n


所有进程打开文件数的限制
/proc/sys/fs/file-max


同时要更改

/proc/sys/fs/inode-max

此值为file-max的3-4倍,具本描述查看man文档

man proc


启动"组策略":开始-运行-gpedit.msc-确定

左侧"用户配置"-管理模板-windows组件-windows资源管理器

右侧双击第三项:  从"工具"菜单删除"文件夹选项"菜单

选中"已禁用"-确定

dmidecode

| 暂无评论 | 暂无引用通告
    dmidecode  is a tool for dumping a computer's DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system's hardware components, as well as other  useful  pieces  of  information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware.  While this is a good point in terms of report speed and safeness, this  also  makes the presented information possibly unreliable.

使用dmidecode命令查看硬件信息
Linux下如何获取主板序列号信息

windows下的md5sum

| 暂无评论 | 暂无引用通告
命令行工具:
http://downloads.activestate.com/contrib/md5sum/Windows/md5sum.exe
将其存放至
C:\WINDOWS\system32
cmd->所要验证的目录:
D:\test>md5sum test.gz

GUI软件: winMd5Sum
http://www.nullriver.com/downloads/Install-winMd5Sum.exe
如果文件太大的话,不是很好用。



Linux企业集群

| 暂无评论 | 暂无引用通告
http://book.51cto.com/art/200806/76015.htm

读完这本书后,对Linux集群有新的认识。

dreamhost中禁用CGI

| 暂无评论 | 暂无引用通告
在需要禁用CGI的目录中创建.htaccess文件,内容如下:

Options +IncludesNoExec -ExecCGI

这样,此目录下的文件就会不以CGI方式运行了。

使用Perl进行web制表

| 暂无评论 | 暂无引用通告
ChartDirector
http://www.advsofteng.com/
下载地址
http://www.advsofteng.com/download.html

安装ChartDirector
使用
perl -V
得到perl的@INC
将lib下的内容copy到INC的任一路径中

cd ChartDirector
cp -rf lib/*  /usr/lib/perl5/5.8.5/
如果自己定制目录的话,在编写脚本时,可在脚本头部加如下代码:
如:
use lib "/home/supersun/ChartDirector/lib/";


chart_create.pl


用法:
chart_create.pl  -f 数据文件 -m 图表类型 -t 图表标题 -p 图片文件名 -x X轴标题 -y Y轴标题
图表类型为:
bar 柱状图
line    曲线图
数据文件格式:
date                    host1     host2     host3     host4     host5     host6     host7     host8
20090101                3031132 3253513 3035196 3130065 3323986 3024694 3076513 3287113
20090102                3610310 3545421 3332149 3862804 3352384 3361875 3341946 3412295
20090103                3756983 3815154 3997797 3941998 3760445 3730529 3721120 3672436
20090104                3926538 3875646 3902116 4038819 4058506 3886227 3846330 4052068
20090105                3905990 4000435 3936811 3863121 3843673 3844999 3786345 3868149

#!/usr/bin/perl
#chart_create.pl
#author: supersun06@gmail.com
#url:  http://supersun.biz
use strict;
use lib dirname($0);

use perlchartdir;
use Getopt::Std;

sub line_grap;
sub bar_grap;
sub usage;

my %opts;
getopt('fmtpxy',\%opts);

my $file=$opts{f};
my $mode=$opts{m};
my $title=$opts{t};
my $png_file=$opts{p};
my $x_title=$opts{x};
my $y_title=$opts{y};

$x_title="X" if $x_title eq '';
$y_title="Y" if $y_title eq '';
usage unless $mode eq "line" || $mode eq "bar";
usage if  -z $title || -z $png_file;
die "$file isn't exsit\n" unless -f $file;



my $data={};
open FD,$file;
my @entries=<FD>;
my $head=[];
@{$head}=split /\s+/,$entries[0];
foreach my $entry (@entries){
        chomp $entry;
        my @utils=split /\s+/,$entry;
        foreach my $i (0..scalar(@$head)-1){
                push @{$$data{$$head[$i]}},$utils[$i];
        }
}
if($mode eq "bar"){
        bar_grap($png_file,$title,$x_title,$y_title,$head,$data);
}else{
        line_grap($png_file,$title,$x_title,$y_title,$head,$data);
}




sub usage {
        print "$0 -f datafile -m line|bar -t graph_title -p image_name -x x_title -y y_title\n";
        exit;
}

sub line_grap {
        my ($file,$head,$x_title,$y_title,$lable,$data)=@_;

        my $x_lable_tag=shift @$lable;
        print "$x_lable_tag\n";
        shift @{$$data{$x_lable_tag}};
        my @corlor=(0xffff00, 0x00ff00, 0x9999ff, 0xff0000, 0x223366,0xff8800, 0xa0bdc4, 0x999966, 0x333366, 0xc3c3e6);

        my $c = new XYChart(1200, 400, 0xffffc0, 0x000000, 1);
        $c->setPlotArea(80, 50, 1100, 300, 0xffffff, -1, -1, 0xc0c0c0, -1);
        $c->addLegend(45, 12, 0, "", 8)->setBackground($perlchartdir::Transparent);
        $c->addTitle($head, "arialbd.ttf", 9, 0xffffff)->setBackground($c->patternColor([0x004000, 0x008000], 2));
        $c->yAxis()->setTitle($y_title);
        $c->xAxis()->setTitle($x_title);
        $c->yAxis()->setLabelFormat("{value}");
        $c->xAxis()->setLabels($$data{$x_lable_tag});
        my $layer = $c->addLineLayer();
        foreach my $util (@$lable){
                my $col=shift @corlor;
                my $tag=shift @{$$data{$util}};
                $layer->addDataSet($$data{$util}, $col, $tag)->setDataSymbol($perlchartdir::SquareSymbol, 7);
        }



        #$layer->setDataLabelFormat("{value}");
        $c->makeChart("$file")
}

sub bar_grap {
        my ($file,$head,$x_title,$y_title,$lable,$data)=@_;
        my $x_lable_tag= shift @$lable;
        print "$x_lable_tag\n";
        shift @{$$data{$x_lable_tag}};

        my @corlor=(0xffff00, 0x00ff00, 0x9999ff, 0xff0000, 0x223366,0xff8800, 0xa0bdc4, 0x999966, 0x333366, 0xc3c3e6);

        my $c = new XYChart(1200, 400);
        $c->addTitle($head, "", 10);
        $c->setPlotArea(80, 50, 1100, 300, 0xffffc0, 0xffffe0);
        $c->addLegend(55, 18, 0, "", 8)->setBackground($perlchartdir::Transparent);
        $c->yAxis()->setTitle($y_title);
        $c->xAxis()->setTitle($x_title);
        $c->yAxis()->setTopMargin(20);
        $c->xAxis()->setLabels($$data{$x_lable_tag});
        my $layer = $c->addBarLayer2($perlchartdir::Side, 7);
        foreach my $util (@$lable){
                my $col=shift @corlor;
                my $tag=shift @{$$data{$util}};
                $layer->addDataSet($$data{$util},$col, "$tag");
        }
        $c->makeChart("$file")
}

运行
perl chart_create.pl -f data -m line -t "a test " -p line.png -x date -y pv
perl chart_create.pl -f data -m line -t "a test" -p bar.png -x date -y pv
bar.png

line.png
Windows下使用方法:
下载ActivePerl
http://www.activestate.com/activeperl/features/
下载ChartDirector,平台选择windows
http://download2.advsofteng.com/chartdir_perl_win32.zip
下载脚本,将其存放到D:\perl\chartdir_perl_win32\ChartDirector\lib\chart_create.pl
chart_create.pl
perl chart_create.pl -f c.txt -m bar -t "a test " -p line.png -x date -y pv
运行命令即可。





最新资源

  • line.png
  • bar.png

关于此归档

这里是2009年4月的所有日记,它们按照时间从新到老排序。

上一篇日记2009年3月

下一篇日记2009年5月

首页归档页可以看到最新的日记和所有日记。