Created
October 5, 2011 08:46
-
-
Save shizukukun/1263953 to your computer and use it in GitHub Desktop.
TeraTerm macro to save startup-config for NEC IX Series
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ---------------------------------------------- | |
; backup.ttl | |
; author : shizuku_kun | |
; blog : http://blog.livedoor.jp/shizuku_kun/ | |
; mail : shizukukun.android@gmail.com | |
; twitter : @shizuku_kun | |
; ---------------------------------------------- | |
; | |
;TeraTerm用のマクロです。 | |
;ルータにログインした後、startup-configを保存するのが面倒なので作りました。 | |
;基本的にNECのIX系ルータに合わせてます。 | |
;コマンド似てるのでCiscoでも使えるはず。 | |
; | |
;使い方 | |
;ログインして、show start出来る状態になったらマクロ実行。 | |
;カレントディレクトリにテキストが生成されます。 | |
;他ルータでも少しいじれば使えます。 | |
; | |
timeout = 2 | |
commandtosend = 'show start' | |
savename = '' | |
setsync 1 | |
gettime timestr '_%Y%m%d_%H%M%S.txt' | |
sendln 'terminal length 0' | |
sendln commandtosend | |
result=1 | |
while result=1 | |
recvln | |
strmatch inputstr '^hostname\s+(.+)' | |
if result > 0 then | |
strconcat savename groupmatchstr1 | |
strconcat savename timestr | |
result=0 | |
else | |
result=1 | |
endif | |
endwhile | |
sendln commandtosend | |
waitln commandtosend | |
fileopen file savename 0 | |
count = 1 | |
result=1 | |
while result=1 | |
recvln | |
if count == 1 then | |
recvln | |
recvln | |
endif | |
if result == 0 then | |
break | |
endif | |
filewriteln file inputstr | |
count = count + 1 | |
endwhile | |
setsync 0 | |
fileclose file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment