在现在的这个公司一直使用tera term来远程连接服务器,感觉很方便,特别是它的ttl脚本配置的自动连接。有时候我们可能无法直接连接到目标服务器,需要通过ssh经过多个中间服务器才能连接到目标服务器。如果此时让我们在终端下一行一行命令的敲,实在是很烦的一件事情,我遇到过的最多的是中间经过三次服务器的ssh才连接到了目标服务器。虽然都是Ctrl+c 、Ctrl+v 。但是每天一上班就开好几个终端每次到这么一个一个敲很麻烦,而tera term的ttl脚本就帮助我们解决了这个问题。
Tera Term
这是一个类似于putty这样的一个远程连接的终端软件,通常就是那些ssh、ftp、sftp、scp的协议使用的浏览linux系统的远程连接软件(本人自己的体会,哈哈、、、)
这是一个日本人开发的软甲,小鬼子做的还是很不错的。网上找了找资料发现资料比较少,那共享一下我的理解。也用过一段时间的putty,但是没有发现putty有类似的功能。每次都要输入用户名,密码,然后ssh命令,然后又是密码,真是很烦!tera term的ttl脚本就帮助我们解决了问题
相关资料:
tera term 英文官网:http://www.teraterm.net/manual/en/
ttl 命令手册:http://www.teraterm.net/manual/en/macro/command/index.html
这里在贴一片博文(http://my.oschina.net/u/183789/blog/37469)
介绍几个常用的命令
a. 通过Tera Term连接PFC所在的机器以及断开连接
通过TTL的connect/disconnect命令实现
Connect:
connect '192.168.137.27 /ssh /auth=password /user=username /passwd= passwd'
注:其中username是用户名,passwd是密码
Disconnect:
注:disconnect后面指定参数,这样就不弹出确认框了。
b. 通过log记录全程操作过程,最终通过比对log确认测试结果。
通过logopen/logclose命令来写log
logopen:
logopen filename 0 1 1
注:filename最好设成命令名,不通ttl脚本不要重复。也可以带执行的时间,
例如:Show_candidate_config_ 20110426-130939.log
方法如下:
gettime timestr "%Y%m%d-%H%M%S"
getdir mdir
logclose :
logclose
c. 测试项作成时可能用到的命令
Pause:(暂停)
pause <time>Remarks:Pauses for <time> seconds.
Sendln:(发送命令并换行)
sendln <data1> <data2>....
Remarks:Causes Tera Term to send characters followed by a new-line character to the host.
Send:(发送命令)
send <data1> <data2>....
Remarks:Causes Tera Term to send characters to the host.
If <data> is a string, the string is sent to the host.
If <data> is an integer, its lowest-order byte (0-255) is regarded as an ASCII code of the character, and the character is sent to the host. 例如:按Tab键的命令是send #9
wait:(等待匹配的字符串出现)
wait <string1>