teraterm 执行sql命令_tera term的ttl脚本使用方法
介绍几个常用的命令
a.通过Tera Term连接PFC所在的机器以及断开连接
通过TTL的connect/disconnect命令实现
Connect:
connect '192.168.137.27 /ssh /auth=password /user=username /passwd= passwd'
注:其中username是用户名,passwd是密码
Disconnect:
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
sprintf2 filename '%s\ Show_candidate_config _%s.log' mdir timestr
logclose
:
logclose
c.测试项作成时可能用到的命令
Pause:(暂停)
pause Remarks:Pauses for seconds.
Sendln:(发送命令并换行)
sendln ....
Remarks:Causes Tera Term to send characters followed by a new-line character to the host.
Send:(发送命令)
send ....
Remarks:Causes Tera Term to send characters to the host.
If is a string, the string is sent to the host.
If 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 [ ...]
Remarks:Pauses until one of the character strings is received from the host, or until the timeout occurs. Maximum number of the strings is 10.
注:使用这个命令是需要设置timeout时间,命令的返回结果保存在resault变量中,当resault为时,则为超时。Timeout设置命令如下:
timeout=1 /*等号后面的值为整数,设为负则是无限等待*
waitln:(等待整行匹配的字符串出现)
waitln [ ...]
Remarks:Pauses until a line which contains one of the character strings is received from the host, or until the timeout occurs. Maximum number of the strings is 10.
注意点同上其他命令例如if,then,elseif,else,endif,goto等请参考help文件。
脚本作成的注意点
a.不同的ttl脚本内指定的Log文件名不能重复。
b.脚本的最后部分请清空测试环境,以便下一个ttl脚本执行。
c.在执行比较缓慢的地方,例如连接机器时,请追加pause命令
d.脚本尽量写得简洁短小,以便式样发生变更时易于更改。
e.必要的时候可以追加注释
使用例子:
1,在window下创建bat文件,
"C:\Program Files\teraterm\ttpmacro.exe" "D:\My Kownhow\TTL\test.ttl"
exit
2,生产ttl脚本文件test.ttl
;###connect host
connect '172.28.92.23 /ssh /auth=password /user=root /passwd=password'
pause 1
;###create log
gettime logstr "log-%Y%m%d-%H%M%S.txt"
getdir curdir
sprintf '%s\%s' curdir logstr
filename = inputstr
logopen filename 0 1 1
logwrite 'Log start'#13#10
looptimes = 1 ;
while looptimes < 11
;###run cmd
sendln "ls -l"
wait "#"
looptimes = looptimes + 1
endwhile
;###closelog
Logclose
;###disconnect
disconnect
closett
执行bat文件就可以运行ttl脚本了.
teraterm 执行sql命令_tera term的ttl脚本使用方法相关推荐
- teraterm 执行sql命令_tera term的ttl脚本使用方法 | 学步园
1.环境构筑 1.安装Tera Term. 下载路径如下: 2.安装可运行的PFC环境 2.运用TTL脚本进行自动测试 TTL脚本的命名一览和相关介绍请参考Tera Term的help文件. TTL脚 ...
- teraterm 执行sql命令_tera term的ttl脚本使用方法[转]
介绍几个常用的命令 a.通过Tera Term连接PFC所在的机器以及断开连接 通过TTL的connect/disconnect命令实现 Connect: connect '192.168.137.2 ...
- python 调用mysql_Python中直接在MySQL执行SQL命令
因为懒,所以不想用SQLyog,用Python写了一个快速执行SQL命令的程序:import pymysql,sys class dealMySQL(object): 'PyMysql' versio ...
- Spark-Sql整合hive,在spark-sql命令和spark-shell命令下执行sql命令和整合调用hive
1.安装hive 如果想创建一个数据库用户,并且为数据库赋值权限,可以参考:http://blog.csdn.net/tototuzuoquan/article/details/52785504 2. ...
- Python执行 SQL 命令并实时打印输出
需要借助exe_command函数,该函数通过subprocess执行 shell 命令,并实时打印输出. from subprocess import Popen, PIPE, STDOUTdef ...
- SQLCMD下执行SQL命令失败但没有任何错误提示
转载于:https://www.xin3721.com/Articlesqldatabase/sql12441.html 今天使用SQLCMD执行SQL文件,将数据导入到SQL SERVER数据库中, ...
- shell脚本mysql_Shell脚本中执行sql语句操作MySQL数据库的几个方法
实验如下: [root@idb1 ~]# more /etc/issue CentOS release 6.5 (Final) Kernel \r on an \m mysql> show va ...
- java阻塞执行命令_java执行bat命令碰到的阻塞问题的解决方法
使用Java来执行bat命令,如果bat操作时间过长,有可能导致阻塞问题,而且不会执行bat直到关闭服务器. 如: Runtime r=Runtime.getRuntime(); Process p= ...
- SpringWeb项目Maven执行clean命令后编译拒绝访问的解决方法
执行clean命令后准备编译打包,报错如图 问题原因:可能是clean后没有清除干净,还在访问原来的classes文件,但是没有权限 解决方法: 使用IDEA的 清除缓存重启一下 使用Eclipse的 ...
最新文章
- 中国学前教育行业投资机会评估与运营展望规划报告2022版
- 北京内推 | ​美团无人车团队招聘视觉算法实习生
- 如何在论文中自动生成标准的参考文献格式
- 疫情期间程序员大学生居家远程办公神器--ToDesk
- Windows平台下go编译器LiteIDE的安装和使用
- SQL Server 日志数据库清理办法
- 他是BAT 100万+年薪大数据专家,今天你可以免费学习他的内部课程,仅限100人...
- Apache日志配置详解(rotatelogs LogFormat)
- LayaAir 获取对象边界 getBounds/ getGraphicBounds
- html视频文件哪种格式好,常见的视频格式有哪些?
- 电路串联和并联图解_判断串联并联电路图口诀
- PingTunnel隧道搭建
- 增强 扫描王 源码_制作一个类“全能扫描王”的简易扫描软件(opencv)
- html5 心形照片墙,教你两种“心形拼图”法|制作照片墙,3分钟搞定!
- Github Page 个人主页——自定义域名
- 预训练模型(PTMs)发展史
- 软件质量保证和软件配置管理
- 网络共享计算机怎么连接,电脑共享网络怎么连接
- 百万军中取上将首级如探囊取物, 千万行里改关键源码在弹指瞬间。 功能超强的程序编辑器!
- Python_内置函数之round的幺蛾子