Re: Perl script to monitor memory usage on unix box

2010-02-08 Thread Yue Chen
Hi Dave Have you ever tried module Proc-ProcessTable? It is a wonderful tool to collect process information such as PID, cmdline, CPU usage and Mem usage. > Hi everybody, > > I want to write a script that checks memory usage of my RHEL box, and ran as > a cron job say every 10 minutes. > > I coul

Re: How to get unresolved cwd?

2009-12-29 Thread Yue Chen
Hi Randal You are right. I can only make my script to get unresolved path by enforcing it to know how it reaches the unresolved path. Thank you for the help. > > Yue> I know I can use environment variable '$ENV{PWD}' to get unresolved > Yue> value but it is unreliable because this environment va

How to get unresolved cwd?

2009-12-29 Thread Yue Chen
Hi As we all know, we can use code such as 'use Cwd; $cwd = getcwd()' to get current working path. If my current path is a soft link /this/is/a/link pointing to /this/is/a/realpath, the function 'getcwd' returns the resolved value of '/this/is/a/realpath'. I know I can use environment variable '$

How to get rid of underline in Term::Readline::GNU's prompt?

2009-05-04 Thread Yue Chen
Hi Guys I am using Term::Readline::GNU to develop a tool with tab extention. So far everything is all right except the prompt string is underlined in my term. I am not sure whether it is an issue of library or my terminal. I also googled and searched CPAN but failed to get the answer. Did anyone h

Re: Is there a better way to get current tty name

2008-10-27 Thread Yue Chen
Sorry, I've got the answer. It should be $mytty = POSIX::ttyname(1); 2008/10/28 Yue Chen <[EMAIL PROTECTED]>: > Hi > > I am writing a perl script which need send current tty to another program. > > Now i am using external cmd 'tty' and redirect the result t

Is there a better way to get current tty name

2008-10-27 Thread Yue Chen
Hi I am writing a perl script which need send current tty to another program. Now i am using external cmd 'tty' and redirect the result to my variable, such as: $mytty = `tty`; Since sometimes 'tty' is not in my PATH, my script is not always successful. So is there a better perl internal mecha

Re: How to catch error message instead of printing to stderr for rmtree

2008-09-25 Thread Yue Chen
Hi Thank you for the feedback. But I don't see any difference between my script and CPAN's documentation. Actually, I do follow it to write my script. > > > On Fri, Sep 26, 2008 at 12:17 AM, Yue Chen <[EMAIL PROTECTED]> wrote: >> >> Hi >> >> I wan

How to catch error message instead of printing to stderr for rmtree

2008-09-25 Thread Yue Chen
Hi I want to use rmtree to delete a dir and use variables to catch the error message. However, when i am about to delete a dir that does not belong to me, it still print the error message to stderr. Does anyone have clue? my script: test.pl use File::Path; File::Path::rmtree( '/root', {error =>

how to get timezone in perl

2008-01-18 Thread Yue Chen
Greetings, perl fans I am about to translate a bash script into perl. In bash script, it uses "date +%Z" command to get current timezone on local host. However, I don't want to redirect this output into a variable, since the perl script will even going to be run on windows. Is there a module to g