Subject: | Proc-ProcessTable can't show "mysqld" process while 'ps' or 'pgrep' can |
I tried to get process info of "mysqld" with Proc::ProcessTable under a
ordinary user. It seems that 'ps' and 'pgrep' can "see" the process but
Proc::ProcessTable can't (works in root user).
here is the commandlines:
$pgrep mysqld
32220
$ps -auwwx -p 32220
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
mysql 32220 0.0 3.3 321816 69584 pe- S Mon06PM 0:31.00
/usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql
--datadir=/usr/local/mysql/data --user=mysql
--pid-file=/usr/local/mysql/data/mysql.pid --port=3306
--socket=/tmp/mysql.sock
this is Perl scripts:( no results returned)
#!/usr/bin/perl
use strict;
use warnings;
use Proc::ProcessTable;
my $t = new Proc::ProcessTable ;
foreach my $p (@{$t->table}) {
if( $p->pid == 32220 ){ # replace with actual mysqld pid
printf( "Pid : %d, Name : %s, Cmd : %s\n",$p->pid , $p->fname ,
$p->cmndline );
}
}
Proc::ProcessTable version : '0.43';
My system info :
$uname -a
FreeBSD localhost 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7
04:42:56 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP
i386
$perl -v
This is perl, v5.8.8 built for i386-freebsd-64int
(with 1 registered patch, see perl -V for more detail)