[wplug] perl help

Ryan Frenz rfrenz at andrew.cmu.edu
Sun Feb 15 13:05:17 EST 2004


I'm executing the program using 'system'.  But what I want to do is after
the command is executed remotely, get the pid of that command.  I'm trying
to append '|ps' to the ssh command, and it prints the output to stdout.
Is there a way I can capture this output in the perl script (without
showing it to the user) and still allow the user to enter the ssh
password?

The current script:

# !perl

$prog = $ARGV[0];
$label = $ARGV[1];
$machine = $ARGV[2];

system ( "ssh $machine \"$prog | ps\"");

exit (0);

On Sun, 15 Feb 2004, John Harrold wrote:

> Sometime in February Ryan W. Frenz assaulted the keyboard and produced:
>
> | OK, now (probably) a tougher problem.  How can I get the script to
> | collect the PID of the process launched through ssh?  What I mean is, if
> | my perl script executes 'ssh <machine> <command>', I want to then know
> | what the process ID of <command> is on <machine>.  Is this even possible?
>
> how exactly are you executing the program? are you using the backtics `?
>
> --
> --------------------------------------------------------------------------
>                                                | /"\
>  john harrold                                  | \ / ASCII ribbon campaign
>       jmh at member.fsf.org                    |  X  against HTML mail
>            the most useful idiot               | / \
> --------------------------------------------------------------------------
>  What difference does it make to the dead, the orphans, and the homeless,
>  whether the mad destruction is brought under the name of totalitarianism or
>  the holy name of liberty and democracy?
>  --Gandhi
> --------------------------------------------------------------------------
> gpg --keyserver keys.indymedia.org --recv-key F65A739E
> --------------------------------------------------------------------------
>



More information about the wplug mailing list