Python Forum
ssh remote command with list
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ssh remote command with list
#3
Thanks DeaD_EyE!
You hint of "ip_command = 'ip link show {}'.format(link)" helped

#!/usr/bin/python
import subprocess

node = ['node41', 'node42', 'node52']
link = ['eth0', 'eth0', 'eht0']

for i in range(len(node)):
     ip_command = 'ip link show {}'.format(link[i])
       print ip_command
       subprocess.call(["ssh", node[i], ip_command])
Reply


Messages In This Thread
ssh remote command with list - by pythonnew - Jun-16-2017, 08:52 PM
RE: ssh remote command with list - by DeaD_EyE - Jun-16-2017, 10:16 PM
RE: ssh remote command with list - by pythonnew - Jun-17-2017, 12:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Passing List of Objects in Command Line Python usman 7 3,226 Sep-27-2020, 03:45 PM
Last Post: ndc85430
  Select correct item from list for subprocess command pythonnewbie138 6 3,350 Jul-24-2020, 09:09 PM
Last Post: pythonnewbie138
  python if command for a list fid 3 2,023 May-08-2020, 11:52 AM
Last Post: fid
  Add list item into executable command zhome888 2 2,147 Dec-19-2019, 12:23 AM
Last Post: zhome888
  How to use list (structure) in the SQL Select command? pyuser1 2 2,940 Apr-27-2018, 02:33 PM
Last Post: pyuser1
  How to find the list of dependencies not present in the remote artifactory repository csplrj 6 4,740 Mar-30-2018, 03:43 PM
Last Post: csplrj
  Saving shell command into a List steackfrite 4 3,963 Aug-31-2017, 11:28 AM
Last Post: steackfrite

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020