amazon - python subprocess popen run multiple command -


I want to open several commands in Python. I installed putty in windows.

  1. SSH in linux machine

      ssh_command_string: plink -i yourppk.ppk ec2-user @ instanceIp   
  2. A command from that machine will generate a file

      export_project_command_string: ./AppManage -exportoutout / opt / notme-   
  3. Download this file

       

    download_command_string: pscp -scp -i yourppk.ppk ec2-user @ instanceIp: / opt / notme-facebook .xml D: \

    These commands are okay when I check them one by one, but I do not know how to do them in Python To be called once.

    I have tried the following code, but no luck:

      LINE_BUFFERED = 1 #NOTE: The first argument is a list p = popen (['cat'] Time = sleep, sleep = true, bufsize = LINE_BUFFERED, stdin = pipew, stdout = pipis, stderr = pipi) for cmd [ssh_command_string, cd_command_string, expo rt_project_command_string, download_command_string]: time.sleep (1) # There is a delay that order one after another even without a p.stdin.write (cmd) p.stdin.flush () #. False () works my machine p.stdin.close ()    

    Repetition / To perform automatic tasks, see on a server.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -