Sponsored Content
Full Discussion: automation using python
Top Forums Shell Programming and Scripting automation using python Post 302690679 by Arun_Linux on Thursday 23rd of August 2012 08:52:35 AM
Old 08-23-2012
Java automation using python

Im trying to write an automation script using python. I expect this script to log in to a remote server, execute commands and get its output.

Code:
import pexpect 
child=pexpect.spawn('ssh myuser@192.168.151.80')
child.expect('Password:')
child.sendline('mypassword')
get_output = child.sendline('uname')
if get_output == 'Solaris':
  print 'this is solaris server'
else:
  print 'this is some other machine'

The fifth line of the code is wrong. Please let me know how to achieve this, I want to get the output of the command sent.

Also if the output is more than one line, how to store the output?
Is there any other better python module for automatio/remote execution ?

Last edited by Arun_Linux; 08-23-2012 at 10:28 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help in automation...

Hi All, I need to run the same command on many servers. I am using ssh for the same. Following is the script that I am using to fire the same command on multiple machines. #!/bin/bash # Linux/UNIX box with ssh key based login #SERVERS="iqmevrick,iqmango" # SSH User name USR="root" #... (1 Reply)
Discussion started by: nua7
1 Replies

2. UNIX for Advanced & Expert Users

Need help in automation

Hi, I wanted to automate the scp command where i do not want to enter the password each time. So thought of using expect command. Script is executing without any issues but files are not copied to remote server. Can any one help me? Below is my shell script.. #!/bin/ksh ... (6 Replies)
Discussion started by: balasubramani04
6 Replies

3. Shell Programming and Scripting

suggest a python module for automation..

Im planning to automate my testcases. Please suggest me a python module that will ease my automation scripting. General steps involved in the testcase execution: (all steps below are done in linux machine) 1) start the application under test (AUT) 2) connect to oracle/ms sql db and update... (1 Reply)
Discussion started by: Arun_Linux
1 Replies

4. SuSE

"ssh suse-server 'python -V' > python-version.out" not redirecting

Okay, so I have had this problem on openSUSE, and Debian systems now and I am hoping for a little help. I think it has something to do with Python but I couldn't find a proper Python area here. I am trying to redirect the output of "ssh suse-server 'python -V'" to a file. It seems that no matter... (3 Replies)
Discussion started by: Druonysus
3 Replies

5. UNIX for Advanced & Expert Users

Linking Automation

Hi, How to link the files automatically in linux on daily basis ? For example : I have file abc.20130911.txt ln -s source/ abc.20130911.txt dest/abc.20130911.txt But in my machine files will be generate with date time stamp every day, without manual linking every day is there any... (4 Replies)
Discussion started by: Balasankar
4 Replies

6. Shell Programming and Scripting

scp Automation

Hi, I have a requirement to automate SCP command. I have to write the scp command in server1 to copy file from server2 and paste it in server3. I will be passing server2 and server3 as variables. Pls suggest. (1 Reply)
Discussion started by: usrrenny
1 Replies

7. Shell Programming and Scripting

**python** unable to read the background color in python

I am working on requirement on spreadsheet in python scripting. I have a spreadsheet containing cell values and with background color. I am able to read the value value but unable to get the background color of that particular cell. Actually my requirement is to read the cell value along... (1 Reply)
Discussion started by: giridhar276
1 Replies

8. Windows & DOS: Issues & Discussions

How to execute python script on remote with python way..?

Hi all, I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine.. Below is the code I am trying: #!/usr/bin/env python import wmi c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Discussion started by: onenessboy
1 Replies

9. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies
show child(1m)															    show child(1m)

NAME
show child - Displays attribute information about the specified child pointer SYNOPSIS
cdscp show child child-name [attribute-name] [with attribute-name = attribute-value] ARGUMENTS
The full name of a specific child pointer. The last simple name can contain wildcard characters. The name of an attribute; see Descrip- tion for valid attribute names. The value of a particular attribute. DESCRIPTION
The show child command displays the names and values of the attributes specified in attribute-name. You can use a combination of attributes in a single command. Use a space to separate multiple attributes. You can use a with attribute-name = attribute-value clause to limit output only to child pointers whose attributes have values equal to the specified values. A space must precede and follow the = (equals sign). If you do not supply any attributes, the command displays all attributes and their values. The following is a description of child pointer attributes: Specifies the creation timestamp (CTS) of the specified child pointer. Specifies the unique identifier of the directory to which the child pointer refers. Specifies the address, UUID, and name of a set of clearinghouses where a copy of the child directory ref- erenced by the child pointer is located. This attribute also specifies whether the directory in a particular clearinghouse is a master or read-only replica. Specifies the timestamp of the most recent update to an attribute of the child pointer. Privilege Required You must have read permission to the child pointer. If you specify a wildcard child name, you also need read permission to the parent directory. NOTE
This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE. EXAMPLE
The following command displays all of the attributes and values of the child directory to which the child pointer /.:/admin refers: cdscp> show child /.:/admin SHOW CHILD /.../abc.com/admin AT 1991-10-15-15:56:01 CDS_CTS = 1991-10-15-19:55:52.000000003/08-00-2b-1c-8f-1f CDS_UTS = 1991-10-15-19:55:52.000000006/08-00-2b-1c-8f-1f CDS_ObjectUUID = 6b5362e8-8b1c-11ca-8981-08002b0f79aa CDS_Replicas = : Clearinghouse's UUID = 2ab024a8-8b1a-11ca-8981-08002b0f79aa Tower = ncadg_ip_udp:16.18.16.32 Tower = ncacn_ip_tcp:16.18.16.32 Replica type = master Clearinghouse's Name = /.../abc.com/Boston_CH RELATED INFORMATION
Commands: create child(1m), delete child(1m), list child(1m) show child(1m)
All times are GMT -4. The time now is 03:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy