SSH connection command to embedded OS QNX Neutrino via paramiko

42 views Asked by At

I'm trying to establish a SSH connection to a QNX Neutrino OS device and run a file "shutdownDevice" followed by "startupDevice" located in the ls directory. I can do this through PuTTY without any issue. My code below doesn't output any errors and completes successfully but the file "shutdownDevice" and "startupDevice" doesn't actually reboot the device like it does via a PuTTY SSH connection. Could be simple, I'm new to this!

def deviceblahblah():
        # Connect to inputed host through a SSH connection
        client = SSHClient()
        # No ssh host keys, add host keys with auto add policy
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        host = (IPText.get())
        client.connect(host, username='xx', password='xx')
        #Connection Sucessful Information
        print("SSH Connection Successful")
        #Stop the device
        stdin, stdout, stderr = client.exec_command('shutdownDevice')
        #Wait 5 seconds
        time.sleep(5)
        #Start the device
        stdin, stdout, stderr = client.exec_command('startupDevice')
        # Close the client connection    
        client.close()
        print("Connection Closed")
0

There are 0 answers