Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91923

Re: Issuing commands using "exec_command()" of paramiko AND also sending commands together

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <sreenath.cg@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'executed': 0.07; 'problem?': 0.07; 'called.': 0.09; 'subject:using': 0.09; 'cc:addr :python-list': 0.10; 'wed,': 0.15; 'output': 0.15; 'subsequent': 0.15; '(there': 0.16; '3-tuple': 0.16; 'close()': 0.16; 'command,': 0.16; 'connect()': 0.16; 'i.e': 0.16; 'instantiate': 0.16; 'objects).': 0.16; 'subject: \n ': 0.16; 'subject:sending': 0.16; 'wrote:': 0.16; 'variables': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'trying': 0.22; 'cc:no real name:2**0': 0.23; 'am,': 0.23; '2015': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'example': 0.25; 'skip:m 30': 0.27; 'parameters': 0.27; 'message-id:@mail.gmail.com': 0.28; 'command': 0.28; '(it': 0.29; 'didnt': 0.29; 'helpful.': 0.29; 'issuing': 0.29; 'skip:m 60': 0.29; 'that.': 0.30; 'url:mailman': 0.31; 'similar': 0.32; 'post': 0.32; 'url:python': 0.33; 'usually': 0.33; 'channel': 0.34; 'thanks!': 0.34; 'received:google.com': 0.34; 'url:listinfo': 0.35; 'could': 0.35; 'instance': 0.35; 'something': 0.35; 'handle': 0.36; 'but': 0.36; 'url:org': 0.36; 'hi,': 0.37; 'subject:: ': 0.37; 'desired': 0.37; 'someone': 0.38; 'method': 0.39; 'enough': 0.39; 'sure': 0.40; 'your': 0.60; 'providing': 0.61; 'more': 0.62; 'commands.': 0.84; 'me!': 0.84; 'subject:commands': 0.84; 'execution,': 0.91; 'subject:AND': 0.93; 'subject:together': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vuZKdc5u6T3aGyo0wsrxoHQpA7HtckmJc/8T0eAej8c=; b=g+NIh0eno7NiKbPtnAapuGJNbEIibAi8Kjg6sGj+m9neVauE2oHXyFU1oszccP39++ vPpqhcWGiCqMpdCZC8KIwJxBo8i44TAJ3zQyccHl2AarBlYarq5qsXzh3ipqnZFlS3ab a5iic3QJh8xiQzAX5y+y/Jiwy9bhehaGyLAdHMk42QniXh8divWdVoFsF9Tij9zvOfGr Vvga0WYPzF0DFUgf4vItuO5w0esOKrtextZ94lDQ6bm7C3zlkjKDosyiR3F1O5/XnAMo ThUJxXEm4VDfkidAy+qts5fyqjKsPTsDF9YA4RHxu4sGouHtLNP9z+R896aL0eiKxkn8 IvJg==
MIME-Version 1.0
X-Received by 10.152.234.233 with SMTP id uh9mr30435264lac.64.1433315260656; Wed, 03 Jun 2015 00:07:40 -0700 (PDT)
In-Reply-To <3603e97e-686a-47de-aff4-cabfcb930064@googlegroups.com>
References <3603e97e-686a-47de-aff4-cabfcb930064@googlegroups.com>
Date Wed, 3 Jun 2015 12:37:40 +0530
Subject Re: Issuing commands using "exec_command()" of paramiko AND also sending commands together
From Sreenathan Nair <sreenath.cg@gmail.com>
To Pythonista <kukki.kanchana@gmail.com>
Cc python-list@python.org
Content-Type multipart/alternative; boundary=001a1133a96cf67082051797b6b7
X-Mailman-Approved-At Wed, 03 Jun 2015 09:09:57 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.92.1433315397.13271.python-list@python.org> (permalink)
Lines 69
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433315397 news.xs4all.nl 2836 [2001:888:2000:d::a6]:37256
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91923

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

Could you be more specific about your problem? Perhaps an example of
something similar to what you're trying to do would be helpful.

Usually the process is to instantiate paramiko.SSHCLIENT, use the connect()
method with desired parameters and execute commands using the
exec_command(). If you'd like to process the output of the command
execution, then you would store the result of exec_command() into three
variables (it return a 3-tuple of Channel objects).

i.e com_stdin, com_stdout, com_stderr =
my_ssh_client_instance.exec_command("<command>")

The instance of SSHCLIENT is live until the close() method is called.
Meaning subsequent commands can be executed the same way.


On Wed, Jun 3, 2015 at 8:07 AM, Pythonista <kukki.kanchana@gmail.com> wrote:

> Using paramiko's exec_command(), i would like to send a command, process
> its output and do it for several other commands. I notice that its not
> quick enough or something like that.
>
> How would I handle that scenario AND also providing multiple commands
> together (there is 1 post on stackoverflow for issuing multiple commands
> but I am not sure if someone has tried it. It didnt work for me!
>
> Thanks!
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Issuing commands using "exec_command()" of paramiko AND also sending commands together Pythonista <kukki.kanchana@gmail.com> - 2015-06-02 19:37 -0700
  Re: Issuing commands using "exec_command()" of paramiko AND also sending commands together Sreenathan Nair <sreenath.cg@gmail.com> - 2015-06-03 12:37 +0530
    Re: Issuing commands using "exec_command()" of paramiko AND also sending commands together KR <kavithabhaskaran2013@gmail.com> - 2015-06-03 06:07 -0700

csiph-web