os.popen方法获取返回内容HeadText=os.popen('sed-n1p\"{}\"'.format(DirFile)).read()os.systemmethod执行运行命令Command="sh/home/TradeInfo/new/trade_plan/py/CopyTradeplan.sh"os.system(Command)pythoncallsshcommand#!/usr/bin/python3importosKeyFile="/root/.ssh/id_rsa"#客户端的私钥,无论哪一端生成私钥和公钥,客户端都有私钥,服务器端就是公钥#想想git是否允许你生成私钥和公钥,然后让你把公钥贴上去以前一般都是服务端是公钥,私钥由客户端保存defcheck_server_df(host,port,username,pkey,command):try:data=os.popen('ssh-p{}-i{}{}@{}{}'.format(port,pkey,username,host,command)).read()除了Exceptionase:print(e)return数据打印(check_server_df(“192.168.10.215”,“22”,“root”,KeyFile,“date"))由GoodMai提供。更多建站及货源交易信息,请见GoodMai好购网
