Skip to content

Instantly share code, notes, and snippets.

@huzhifeng
Created October 13, 2014 02:26
Show Gist options
  • Save huzhifeng/f7b7ff703af520d13bd1 to your computer and use it in GitHub Desktop.
Save huzhifeng/f7b7ff703af520d13bd1 to your computer and use it in GitHub Desktop.
A TTL(Tera Term Language) script used for automatic reboot test
; TTL Script used for automatic reboot test
username = 'root'
password = 'root'
usernamePrompt = 'login'
passwordPrompt = 'Password'
oopsPrompt = 'Oops'
panicPrompt = 'Kernel panic'
maxLoop = 1000
gettime now '%Y/%m/%d-%H:%M:%S'#13#10
sprintf2 startTime 'AutoReboot started at %s' now
gettime logfile "AutoReboot-test-log-%Y%m%d-%H%M%S.txt"
logopen logfile 0 0 0 0 0 0
logwrite startTime
for i 1 maxLoop
wait usernamePrompt oopsPrompt panicPrompt
if result = 0 then
gettime now '%Y/%m/%d-%H:%M:%S'
sprintf2 tempTime 'Exception: Timeout at %s after %d times reboot'#13#10 now i
logwrite tempTime
elseif result = 1 then
sendln username
wait passwordPrompt
sendln password
elseif result = 2 then
gettime now '%Y/%m/%d-%H:%M:%S'
sprintf2 tempTime 'Exception: Oops at %s after %d times reboot'#13#10 now i
logwrite tempTime
logclose
exit
elseif result = 3 then
gettime now '%Y/%m/%d-%H:%M:%S'
sprintf2 tempTime 'Exception: Kernel panic at %s after %d times reboot'#13#10 now i
logwrite tempTime
logclose
exit
else
logwrite 'Unknown Error'#13#10
endif
sendln
gettime now '%Y/%m/%d-%H:%M:%S'
sprintf2 rebootTime 'AutoReboot %d times at %s'#13#10 i now
dispstr rebootTime
logwrite rebootTime
sendln
sendln 'reboot'
next
gettime now '%Y/%m/%d-%H:%M:%S'
sprintf2 stopTime 'AutoReboot stopped at %s after %d times reboot'#13#10 now i
logwrite stopTime
logclose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment