User Profile

Collapse

Profile Sidebar

Collapse
spgreddy
spgreddy
Last Activity: Dec 16 '14, 09:45 AM
Joined: Nov 18 '14
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • spgreddy
    started a topic jython code

    jython code

    Hi,

    When I execute below program I am getting the below output.

    Code:
    for row in c.fetchall():
            urls=row
            print urls
    ('http://10.136.229.129: 7010',)
    ('http://10.136.229.129: 7020',)
    ('http://10.136.229.129: 7030',)
    ('http://10.136.229.129: 7040',)
    ('http://10.136.229.44:7 050',)
    ('http://10.136.229.44:7 060',)
    ('http://10.136.229.44:7 070',)
    ('http://10.136.229.44:7 080',)...
    See more | Go to post

  • spgreddy
    replied to how to execute the shell script in python
    Hi

    I got the answer for this.
    Code:
    import commands
    
    commands.getoutput("/sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' |cut -d: -f2 | awk '{ print $1}'")
    will return the actual ip address like '10.120.11.123'

    Regards,
    Siva
    See more | Go to post

    Leave a comment:


  • spgreddy
    replied to how to execute the shell script in python
    Hi bvdet,

    The
    Code:
    socket.gethostbyname(hostname)
    command returns only loopback address 127.0.0.1 but it won't display actual IP address like '10.111.212.111 . Thats the reason i want to execute the below command in python.

    Please let me know how can i execute the below command in python

    Code:
    sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | 'cut -d: -f2 | awk '{ print $1}'
    Regards,
    Siva
    See more | Go to post

    Leave a comment:


  • spgreddy
    started a topic how to execute the shell script in python

    how to execute the shell script in python

    Hi,

    I need to execute the below script in python to find the ip address of a host

    /sbin/ifconfig'+'|'+' grep 'inet addr:''+'|'+' grep -v '127.0.0.1''+'| '+'cut -d: -f2'+'|'+'awk '{ print $1}'

    Please let me know how can I execute that in python script.

    Regards,
    Siva
    See more | Go to post
No activity results to display
Show More
Working...