博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SecureCRT中用vbs脚本批量执行unix命令
阅读量:5902 次
发布时间:2019-06-19

本文共 2523 字,大约阅读时间需要 8 分钟。

SecureCRT中用vbs脚本批量执行unix命令

一般登陆上主机后都会敲一些命令了解主机的主要参数,把常用命令集成在一个vbs脚本里, 自动执行,方便高效。

SecureCRT运行方法:菜单栏Script --> 选择Run --> 选择vbs脚本(后面提供Solaris和AIX操作系统的检测脚本)。

检测SUN主机,solaris_info.vbs如下:

#$language = "VBScript"

#$interface = "1.0"

Sub Main
'清空屏幕
crt.Screen.Send "clear" & chr(13)
crt.Screen.WaitForString "$ "
'主机名
crt.Screen.Send "hostname" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "domainname" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "uname -a" & chr(13)
crt.Screen.WaitForString "$ "
'主机启动时间
crt.Screen.Send "uptime" & chr(13)
crt.Screen.WaitForString "$ "
'主机IP
crt.Screen.Send "cat /etc/hosts" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "ifconfig -a" & chr(13)
crt.Screen.WaitForString "$ "
'主机CPU
crt.Screen.Send "isainfo -kv" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "psrinfo -v" & chr(13)
'主机内存
crt.Screen.WaitForString "$ "
crt.Screen.Send "prtconf | grep Mem" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "swap -s" & chr(13)
crt.Screen.WaitForString "$ "
'Oracle环境变量
crt.Screen.Send "grep ^ORACLE_ .profile" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "echo $NLSLANG" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "echo $TZ" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "echo $PATH" & chr(13)
'主机空间
crt.Screen.WaitForString "$ "
crt.Screen.Send "df -h" & chr(13)
'Oracle服务
crt.Screen.WaitForString "$ "
crt.Screen.Send "tnsping orcl" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "lsnrctl status" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "ps -ef | grep ora
" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "ps -ef | grep LOCAL=NO | grep -v grep | wc -l" & chr(13)
End Sub

检测IBM主机,aix_info.vbs如下:

#$language = "VBScript"
#$interface = "1.0"
Sub Main
crt.Screen.Send "clear" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "uname -a" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "uptime" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "ifconfig -a" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "lsdev -C|grep Process" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "lsattr -E -l sys0 -a realmem" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "lsps -a" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "echo $NLS_LANG" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "echo $TZ" & chr(13)
crt.Screen.WaitForString "$ "
crt.Screen.Send "df -k" & chr(13)
End Sub

--End--

转载于:https://blog.51cto.com/chaochang/2043866

你可能感兴趣的文章
Prometheus安装部署以及配置
查看>>
Oracle存储过程大冒险-2存储过程常用语法
查看>>
taobao-pamirs-schedule-2.0源码分析——类设计
查看>>
10位程序员眼中的2007:寻找软件开…
查看>>
Stream API
查看>>
Web开发之-DOM操作对象
查看>>
APUE第15章学习扎记之程序的存储区布局试验
查看>>
ubuntu升级16.04 inter idea 中文输入法无效
查看>>
查找命令集:which/whereis/locate/find
查看>>
三目运算判断jsp脚本里面的值
查看>>
sqlserver 版 try catch
查看>>
sshtunnel在本地访问云服务器mysql
查看>>
Java类加载器( 死磕8)
查看>>
小蚂蚁学习APP接口开发(1)—— json方式封装通信接口
查看>>
我的友情链接
查看>>
CDN相关
查看>>
Tomcat的设置4——Tomcat的体系结构与设置基于端口号的虚拟主机
查看>>
三种判断端口存活的方法和链接200的判断方法
查看>>
我的友情链接
查看>>
ftp协议基础
查看>>