import pexpect
from pexpect import *
import sys
SPAWNED_BASE_CODE=100
MAIN_ERROR=1
PASS_ERROR=2
TIME_OUT_ERROR=3
UNKNOWN_ERROR=4
SSH_CON_ERROR=5
keys=["authenticity","assword","incorrect",TIMEOUT,EOF,"sshexit"]
params=sys.argv[1:]
rootPwd=params[0]
command=params[1:]
command = ' '.join(command)
runCmd='su - root -c "%s; echo $?sshexit"' % (command)
print runCmd
try:
child=pexpect.spawn(runCmd)
except Exception,inst:
阅读(396) | 评论(0) | 转发(0) |