十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
def exec_command(shell_cmd, hostname=None):
if hostname:
p = Popen('/usr/bin/ssh -Tq '+hostname, shell=True, stdout=PIPE, stdin=PIPE)
p.stdin.write(str.encode(shell_cmd))
p.stdin.flush()
else:
p = Popen(shell_cmd, shell=True, stdout=PIPE, stdin=PIPE)
stdout, stderr = p.communicate()
return stdout, stderr, p.poll()