Skip navigation

工作中遇到的问题。拿来充数。

VERITAS Storage Replicator 带了一个命令行工具,SRTOOL,所有GUI上的操作都可以用这个命令行实现,这是一个交互的环境。
ex.

list name,jobstate of all jobs

PROD_Adxt_toDR           RunningWithErrors
PROD_WasdfetOffe_toDR Running
DR_Sdnd_DRPROD            NeverRun
DR_WallreO_DPROD   Expired

List AssocObjName,Description,TimeStamp of Last Alerts

PROD_Adxt_toDR Pair finished synchronization. 4/11/2010 14:49:50.462

 

SRTOOL 有个参数-cmd 可以将SRTOOL的命令直接在DOS命令行上执行并退出,如,

#srtool –cmd list all jobs whose jobstate eq running

列出所有运行的任务

然而这个命令是没有办法重定向输出到文件的。

#srtool –cmd list all jobs > output.txt

你将仍然会从屏幕得到输出,而output.txt里空空如也;但是在交换模式中,srtool内置的重定向却可以作用(在交互模式下)

list all alerts >”output.txt”

output.txt会得到输出。

这个和sudo的重定向相似,命令行的解释将>视为srtool的-cmd的参数,但是为什么srtool没有执行就不得而知了。幸好,srtool支持调用子程序

#srtool -cmd exec "vsrcmdlist”

我们将重定向的命令置于vsrcmdlist中,便可成功获得输出vsrcmd.log

#type vsrcmdlist
List Name of all jobs Whose JobState EQ Running >"vsrcmd.log”

 

这样一来,我们就可以用脚本来检测replicator 的运行状态和报警了.利用psexec远程执行命令来批量完成了。oyeah

#psexec @%SERVERLIST%  srtool –cmd exec “vsrcmdlist”

回應文章

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook photo

You are commenting using your Facebook account. Log Out / 變更 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.