Python Forum
Fabric - Run method is not being finished
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fabric - Run method is not being finished
#4
So far i've this:
So far i've this:
sudopass = Responder(pattern=r'Password:', response='admin__password\n')

def su(connection, command) -> int:
    return connection.run(f"su -c '{command}'", pty=True, watchers=[sudopass])

with Connection('192.168.0.106', user="dssadmin", port=22, connect_kwargs={"password": "password"}) as ssh_connection:
    command = "uname -s"
    print("Response on {} is: {}".format(command, ssh_connection.run(command)))
    command = "whoami"
    print("Response on {} is: {}".format(command, ssh_connection.run(command)))
    command = "opkg update"
    print("Response on {} is after executing su command: {}".format(command, su(ssh_connection, command)))
    command = "opkg install rescue-utils"
    print("Response on {} is after executing su command: {}".format(command, su(ssh_connection, command)))
    command = "whoami"
    print("Response on {} is: {}".format(command, su(dss, command)))
print("Script end")
Not exactly what i needed but working fine
Reply


Messages In This Thread
RE: Fabric - Run method is not being finished - by mglowinski93 - Dec-29-2018, 10:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Process finished with exit code 137 (interrupted by signal 9: SIGKILL) erdemath 2 9,515 Apr-18-2022, 08:40 PM
Last Post: erdemath
  Using .hdf5 files only once they are finished writing pyhill00 7 2,785 Nov-25-2021, 06:01 PM
Last Post: pyhill00
  How to check if a file has finished being written leocsmith 2 7,817 Apr-14-2021, 04:21 PM
Last Post: perfringo
  process finished with exit code -1073741819 (0xC0000005) GMCobraz 8 5,379 Sep-01-2020, 08:19 AM
Last Post: GMCobraz
  How to stop Xmodem after bin file transfer was finished shaya2103 0 2,499 Nov-27-2019, 04:33 PM
Last Post: shaya2103
  Process finished with exit code -107374819 (0xC0000375) mrazko 2 8,464 Apr-05-2019, 12:46 PM
Last Post: mrazko
  Progress Finished Question malonn 32 17,458 May-23-2018, 02:43 AM
Last Post: malonn

Forum Jump:

User Panel Messages

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