Hi Anand,
This works for ls, I also tried it to capture ping.
But for some unknown reasons it is not able to capture scp's output.
The variable f is empty.
KartheeK
Anand Balachandran Pillai [EMAIL PROTECTED] wrote: Using os.popen for this is
straight-forward.
Example...
[EMAIL PROTECTED]
KartheeK wrote:
Hi Anand,
This works for ls, I also tried it to capture ping.
But for some unknown reasons it is not able to capture scp's output.
The variable f is empty.
KartheeK
u have to get the standard error stream as well
u can take a look at commands module
ex:
import commands
Hi,
I tried that too but it also for some reasons fails to capture scp output
although it can capture things like ping.
command.getstatusoutput returns exit code but not the string.
KartheeK
gnuyoga [EMAIL PROTECTED] wrote: KartheeK wrote:
Hi Anand,
This works for ls, I also tried it to
KartheeK wrote:
Hi,
I tried that too but it also for some reasons fails to capture scp
output although it can capture things like ping.
command.getstatusoutput returns exit code but not the string.
what do u mean by scp output ?
commands.getstatusoutput will give you output status and
A typical scp transaction would result in an output as below:
---
temp.conf 100% 23
0.0KB/s 00:00
---
I am interested in
In that case, why not use what gnuyoga suggested - i.e. -
commands.getstatusoutput(scp ...). If the first entry in the
returned tuple is 0, the command executed successfully, if not, then
it didn't :). I think you can trust python to get the correct exit
code without actually parsing the output
This is not an easy thing to do. You can capture any error output by scp
by redirecting the error stream,
For example,
$ scp names.txt [EMAIL PROTECTED]:/home/anand 2out.txt
$ more out.txt
names.txt: no such file or directory
However trying to capture the output stream (with no error) does not
Kartheek,
It seems like what you want to do is a bit complicated -
http://www.linuxquestions.org/questions/linux-general-1/how-to-redirect-the-scp-command-output-to-text-file.-629034/.
Maybe if you can explain why you need the exact string that scp
outputs, somebody can suggest alternatives.
On Tue, May 13, 2008 at 3:18 PM, KartheeK [EMAIL PROTECTED] wrote:
Hi Rishabh,
My script needs to fetch some critical config files from 200+ servers,
process them and put them back in place. I need to make sure at each step
that I am doing the right thing.
So, I though i would make sure to
Hi Rishabh,
My script needs to fetch some critical config files from 200+ servers, process
them and put them back in place. I need to make sure at each step that I am
doing the right thing.
So, I though i would make sure to see 100% each time I download a config
file and then only proceed
Looks like that is the best available option..
Thank you all folks for your time and assistance.
Regards,
KartheeK
Rishabh Manocha [EMAIL PROTECTED] wrote: In that case, why not use what
gnuyoga suggested - i.e. -
commands.getstatusoutput(scp ...). If the first entry in the
returned tuple is
11 matches
Mail list logo