X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=suanzi-support;h=183f6de6c749a2c08fd78715810668404847e8b1;hb=049dc4e7874fe73c600469542e5826a188dbc03d;hp=d016b06bd90893ec4e60be05505a9d666c0657e6;hpb=c049e62c874efcae34bbce9e01d4b9829217b0b1;p=remote-debug.git diff --git a/suanzi-support b/suanzi-support index d016b06..183f6de 100755 --- a/suanzi-support +++ b/suanzi-support @@ -7,7 +7,6 @@ from subprocess import call, Popen, PIPE, STDOUT import paho.mqtt.client as mqtt import shlex -import os import random from uuid import getnode as get_mac @@ -39,7 +38,7 @@ def getAvailablePort(host, ports): def exec_ssh(port): if port == None: raise Exception('Port not avaliable') - command = 'sshpass -p' + PASSWORD + ' ssh -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -fCR ' + str(port) +':localhost:22 ' + USER + '@' + SSH_SERVER + ' sleep ' + str(ALIVE_TIME) + command = 'sshpass -p' + PASSWORD + ' ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile /dev/null" -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -fCR ' + str(port) +':localhost:22 ' + USER + '@' + SSH_SERVER + ' sleep ' + str(ALIVE_TIME) print command return call(shlex.split(command), shell=False) @@ -67,7 +66,7 @@ class MyClient(mqtt.Client): if __name__ == '__main__': mac = hex(get_mac()) - id = os.getenv('USER') + '-' + '{:0>12}'.format(mac[2:-1]) + id = '{:0>12}'.format(mac[2:-1]) print 'id is: ' , id client = MyClient(id) client.connect(MQTT_SERVER, MQTT_PORT, 60)