|
can ssh execute multiple commands at the same time?
i am using ssh to connect to remote hosts on a network to monitor activity. is it possible to execute multiple commands on the same line? for example?
foreach $host (@hosts) {
print FH "<H3><A NAME\=\"$host\">$host\</A\></H3>";
print FH "<P>";
$cmd="hostname;vmstat;top -n 1 | head -n;df -k";
foreach $host (@hosts) {
print FH "<TABLE BORDER=0>";
@result=`ssh $host -l root -K $cmd`;
foreach $line (@result) {
if ( $line =~/9[0-9]\%\s*\>\// ) {
$count++;
print FH "<TR><TD> <A NAME\=\"$count\"><FONT
COLOR\=\"RED\"\>$line</FONT\></A></TD></TR>";
im a bit lost here, it carries out the first command on the remote machine but then it carries out the remaining commands on the host machine that is running the perl script.
thanx in advance, Singist
|