SecureCRT脚本
来源:互联网 发布:c语言打印字母图形 编辑:程序博客网 时间:2024/05/01 05:14
工作中需要通过SecureCRT管理多台服务器,脚本可以省去大量的体力工作,下面代码是查看各个服务器上某个进程是否在运行。
'@Script: language="VBScript"'@Author: HCDim outputFile, serverFile, foutDim outputPath, serverPathDim user, pwd, ip, snameoutputPath = "C:\Users\haochao\Desktop\out.txt"serverPath = "C:\Users\haochao\Desktop\server.txt"Set fout = CreateObject("Scripting.FileSystemObject")Set outputFile = fout.OpenTextFile(outputPath, 2, True)Set serverFile = fout.OpenTextFile(serverPath, 1, False)Sub main()crt.Screen.Synchronous = TrueDim serverDim arrDo While serverFile.AtEndOfStream <> Trueserver = serverFile.ReadLineserver = trim(server)arr = Split(server)ip = arr(0)user = arr(1)pwd = arr(2)sname = arr(3)Call connect()Loopcrt.Screen.Synchronous = False Call openFile()End SubSub connect()Dim cmdcmd = "/ssh2 /L " & user &" /PASSWORD " & pwd & " /C 3DES " & ipOn Error Resume Nextcrt.Session.Connect cmdif Err.Number <> 0 ThenoutputFile.Write sname & " fail to connect!!!" & vbCrLfElseCall process()End Ifcrt.Session.DisconnectEnd SubSub process()crt.Screen.Send "ps -ef|grep AppServer|grep -v grep" & vbCrIf crt.Screen.WaitForStrings("AppServer", 1) <> False ThenoutputFile.Write sname & " is running..." & vbCrLfElse outputFile.Write sname & " is stop!!!" & vbCrLfEnd IfEnd SubSub openFile()Dim wsSet ws = CreateObject("wscript.shell") ws.run outputPathEnd Sub
- SecureCRT脚本
- SecureCRT脚本
- SecureCRT自动登陆脚本
- SecureCRT 自动登录脚本
- secureCRT 登陆脚本
- secureCRT 自动登录脚本
- Vbscript 编写SecureCRT脚本
- SecureCRT 修改时间脚本
- securecrt的vbs脚本
- SecureCRT录制脚本
- SecureCRT脚本小介绍
- SecureCRT vbs脚本小记
- secureCRT脚本编写
- secureCRT脚本----vbs语法
- SecureCRT脚本-Python
- secureCRT自动登录配置脚本
- VBS教程及secureCRT脚本
- SecureCRT脚本之WaitForString函数
- auto_ptr c++
- 青春划过指尖
- UINavigationBar 手动实现编辑和完成按钮
- 在application中 context的 在全局中使用是否会存在内存泄漏
- 经商之道28条+商场10忌
- SecureCRT脚本
- [java]线程总结
- 青涩的思绪 泛起粉色的涟漪
- vb连接数据库
- 【Effective c++】条款13:以对象管理资源
- ACM大牛!!!!!!
- linux kenrel 笔记
- 通过hello world介绍2.6内核模块编译的最基本原理 .
- 羌笛声声胡笳怨,此心长寄天涯远