本文整理汇总了Python中lib.util.Util.check_shell_status方法的典型用法代码示例。如果您正苦于以下问题:Python Util.check_shell_status方法的具体用法?Python Util.check_shell_status怎么用?Python Util.check_shell_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.util.Util
的用法示例。
在下文中一共展示了Util.check_shell_status方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NodeCompute
# 需要导入模块: from lib.util import Util [as 别名]
# 或者: from lib.util.Util import check_shell_status [as 别名]
host_ip_list = sp_define.get_all_host_ip()
result_dict = {}
for host_ip in host_ip_list:
if not host_ip in sp_define.HOST_LIST: continue
print "\n"
print '='*30 + host_ip + '='*30
host_ip_suffix = Util.get_ip_field(host_ip, 3)
#cmd = 'grep -i error /mnt/' + host_ip_suffix + '/*.log | ' + sp_define.PATTERN_EXCLUSIVE_IN_MEDUSA
#cmd = 'grep -i "' + ERROR_PATTERN + '" /mnt/' + host_ip_suffix + '/medusa/*.log'
cmd = 'grep -i error /root/tools/medusa/shell-sdb/*.log ' + sp_define.PATTERN_EXCLUSIVE_IN_MEDUSA
#print cmd
try:
node = NodeCompute(host_ip)
node.run_cmd(cmd)
ssh = node.get_ssh()
shell_status = Util.check_shell_status(ssh)
if shell_status:
print '-'*80 + '>>> found pattern: ' + ERROR_PATTERN
#subprocess.call(['python', 'medusa_stop.py'])
#subprocess.call(['python', 'get_uptime.py'])
#subprocess.call(['sh', 'get_var_log_msg_all.sh'])
#subprocess.call(['sh', 'get_medusa_log_all.sh'])
#subprocess.call(['python', '../nj/cruz_collect_tech.py'])
#subprocess.call(['python', '../ucsm/system/collect_tech_support.py'])
#sys.exit()
else:
print "found no pattern"
node.exit()
result_dict[host_ip] = True
except (KeyboardInterrupt, AttributeError, pexpect.TIMEOUT):
print "ERROR: Timeout"
示例2: start_pingpong_client
# 需要导入模块: from lib.util import Util [as 别名]
# 或者: from lib.util.Util import check_shell_status [as 别名]
def start_pingpong_client(self, usnic, ip_address):
self._ssh.send_expect_prompt("ibv_ud_pingpong -g 0 -s 100 -d " + usnic + " " + ip_address)
return Util.check_shell_status(self._ssh)
示例3: NodeHead
# 需要导入模块: from lib.util import Util [as 别名]
# 或者: from lib.util.Util import check_shell_status [as 别名]
from lib.node_head import NodeHead
from lib.util import Util
ERROR_PATTERN = 'Data corruption detected'
#ERROR_PATTERN = 'kasdjflasjdlasjfd'
if __name__ == '__main__':
head_node = NodeHead(Define.NODE_HEAD_NAME, Define.NODE_USERNAME_ROOT, Define.NODE_DEFAULT_PASSWORD)
cmd = 'grep -i "' + ERROR_PATTERN + '" /home/export/1*/medusa/*.log'
print cmd
while True:
head_node.run_cmd(cmd)
shell_status = Util.check_shell_status(head_node.get_ssh())
if shell_status:
print '-'*30 + '>>> found pattern: ' + ERROR_PATTERN
subprocess.call(['python', 'medusa_stop.py'])
subprocess.call(['python', 'get_uptime.py'])
#subprocess.call(['python', '../nj/cruz_collect_tech.py'])
#subprocess.call(['python', '../ucsm/system/collect_tech_support.py'])
head_node.exit()
sys.exit()
else:
print "found no pattern"
time.sleep(60)
示例4: start_pingpong_server
# 需要导入模块: from lib.util import Util [as 别名]
# 或者: from lib.util.Util import check_shell_status [as 别名]
def start_pingpong_server(self, usnic):
self._ssh.send_expect_prompt("ibv_ud_pingpong -g 0 -s 100 -d " + usnic)
return Util.check_shell_status(self._ssh)