- 论坛徽章:
- 0
|
10可用积分
哪位高手能给点意见, 我也是编写perl三年多了,但是最近遇到的问题的确是没辙。。。
主要是perl调用unix系统命令 ,遇到输出不全,或者为空。。 可能执行100次,才出现1次这样的情况。(遇到问题,纪录trace发现的)
AIX 平台ps 命令:
if ($^O eq "solaris"
{
$ps_cmd = "/bin/ksh -c ' export COLUMNS=2048 ; /bin/ps -e -o user,pid,etime,pcpu,vsz,args'";
$ps_ucb_cmd = "/bin/ksh -c ' export COLUMNS=2048 ; /usr/ucb/ps -axww'";
$ps_zone_cmd = "/bin/ksh -c ' export COLUMNS=2048 ; /bin/ps -efo zone,pid'";
}
elsif ($^O eq "linux"
{
$ps_cmd = "export COLUMNS=2048 ; /bin/ps -e -o user,pid,etime,pcpu,vsz,args";
}
elsif ($^O eq "hpux"
{
$ps_cmd = "export UNIX95=yes; export COLUMNS=300 ; /bin/ps -ex -o user,pid,etime,pcpu,vsz,args";
}
else
{
$ps_cmd = "/usr/bin/ksh -c 'export COLUMNS=200 ; /bin/ps -e -o user,pid,etime,pcpu,vsz,args'"; # 这里是AIX 最终调用
}
open(CMD,"$ps_cmd|" or die ("Cannot execute ps command" ;
通过CMS,我打印输出,经常结果不全,或者为空
我认为我的代码语法没有问题, 而且该问题,发生概率1% ,而且并不是在所有AIX都发生这个问题。 问题机器的发生频率为1%都没有。。。。(内存,cpu使用都很低)
期待神人帮忙,
如果在上海,我请你吃饭也成。。
我的MSN:baitao2020@163.com |
|