Lines Matching refs:child

79     child = pexpect.spawn('ssh -l %s %s'%(user, host))
80 i = child.expect([pexpect.TIMEOUT, SSH_NEWKEY, COMMAND_PROMPT, '(?i)password'])
83 print child.before, child.after
84 print str(child)
87 child.sendline ('yes')
88 child.expect ('(?i)password')
95 child.sendline(password)
98 i = child.expect ([COMMAND_PROMPT, TERMINAL_PROMPT])
100 child.sendline (TERMINAL_TYPE)
101 child.expect (COMMAND_PROMPT)
106 child.sendline ("PS1='[PEXPECT]\$ '") # In case of sh-style
107 i = child.expect ([pexpect.TIMEOUT, COMMAND_PROMPT], timeout=10)
110 child.sendline ("set prompt='[PEXPECT]\$ '")
111 i = child.expect ([pexpect.TIMEOUT, COMMAND_PROMPT], timeout=10)
115 print child.before
124 child.sendline ('uname -a')
125 child.expect (COMMAND_PROMPT)
126 print child.before
127 if 'linux' in child.before.lower():
133 child.sendline ('uptime')
134 child.expect('up\s+(.*?),\s+([0-9]+) users?,\s+load averages?: ([0-9]+\.[0-9][0-9]),?\s+([0-9]+\.[0-9][0-9]),?\s+([0-9]+\.[0-9][0-9])')
135 duration, users, av1, av5, av15 = child.match.groups()
140 child.match = re.search('([0-9]+)\s+day',duration)
141 days = str(int(child.match.group(1)))
143 child.match = re.search('([0-9]+):([0-9]+)',duration)
144 hours = str(int(child.match.group(1)))
145 mins = str(int(child.match.group(2)))
147 child.match = re.search('([0-9]+)\s+min',duration)
148 mins = str(int(child.match.group(1)))
152 child.expect (COMMAND_PROMPT)
155 child.sendline ('iostat')
156 child.expect (COMMAND_PROMPT)
157 print child.before
160 child.sendline ('vmstat')
161 child.expect (COMMAND_PROMPT)
162 print child.before
166 child.sendline ('free') # Linux systems only.
167 child.expect (COMMAND_PROMPT)
168 print child.before
171 child.sendline ('df')
172 child.expect (COMMAND_PROMPT)
173 print child.before
176 child.sendline ('lsof')
177 child.expect (COMMAND_PROMPT)
178 print child.before
181 # child.sendline ('netstat')
182 # child.expect (COMMAND_PROMPT)
183 # print child.before
186 # child.sendline ('mysql -p -e "SHOW STATUS;"')
187 # child.expect (PASSWORD_PROMPT_MYSQL)
188 # child.sendline (password_mysql)
189 # child.expect (COMMAND_PROMPT)
191 # print child.before
194 child.sendline ('exit')
195 index = child.expect([pexpect.EOF, "(?i)there are stopped jobs"])
197 child.sendline("exit")
198 child.expect(EOF)