Transient has asked for the wisdom of the Perl Monks concerning the following question:
Pretty rudimentary, but what I would like to do is have the parent process listen for STDIN, like top does, and send a SIGHUP to the child to reset it's sort options, lines or whatnot. The while (<>) { doesn't seem to be working like I'd hoped. Any ideas on this one?... my $pid = fork(); # spawn child if ( $pid ) { # parent while ( wait != -1 ) { while (<>) { print "Got $_ on STDIN\n"; } } } else { # child while ( 1 ) { print $header; print `ps guw | sort -n -r -k $sort_option | head -$num_lines`; print "\nSort: $sort_option : Lines: $num_lines : Sleep: $sleep_ti +me\n"; sleep $sleep_time; print `clear`; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Emulating UNIX 'top' on AIX
by jfroebe (Parson) on May 02, 2005 at 15:52 UTC | |
by Transient (Hermit) on May 02, 2005 at 15:53 UTC | |
|
Re: Emulating UNIX 'top' on AIX
by ajt (Prior) on May 02, 2005 at 16:23 UTC | |
|
Re: Emulating UNIX 'top' on AIX
by tcf03 (Deacon) on May 02, 2005 at 15:15 UTC | |
by Transient (Hermit) on May 02, 2005 at 15:17 UTC | |
|
Re: Emulating UNIX 'top' on AIX
by ikegami (Patriarch) on May 02, 2005 at 15:40 UTC | |
by Transient (Hermit) on May 02, 2005 at 15:59 UTC | |
by Transient (Hermit) on May 02, 2005 at 16:09 UTC | |
by ikegami (Patriarch) on May 02, 2005 at 16:12 UTC | |
by Transient (Hermit) on May 02, 2005 at 16:18 UTC | |
|
Re: Emulating UNIX 'top' on AIX
by Transient (Hermit) on May 02, 2005 at 16:57 UTC | |
by 5mi11er (Deacon) on May 02, 2005 at 21:22 UTC |