代码都是网上找的,
我加入了循环,脚本的意思就是循环查询磁盘目录(mnt)
人家的源码位置:https://www.cnblogs.com/li150dan/p/11038216.html
以下内省在xshell6 上可以运行
文件名随意,扩展名是js 例如 xxx.js
/* xshell调用自动化js脚本 */
/* 主函数 */
function Main()
{
while(1)
{
/* 发送cd 改变到当前目录 */
xsh.Screen.Send("df -h");
/* 前面输入的是一条命令,还需要下面这一行输入回车 */
xsh.Screen.Send(String.fromCharCode(13));
/* 发送sz 下载文件 */
//xsh.Screen.Send("sz code_info.log");
/* 前面输入的是一条命令,还需要下面这一行输入回车 */
//xsh.Screen.Send(String.fromCharCode(13));
/* 延时等待1s */
xsh.Session.Sleep(2000);
/* 发送sz 下载文件 */
//xsh.Screen.Send("sz code_error.log");
/* 前面输入的是一条命令,还需要下面这一行输入回车 */
//xsh.Screen.Send(String.fromCharCode(13));
/* 延时等待1s */
//xsh.Session.Sleep(1000);
/* 清屏 */
//xsh.Screen.Clear();
}
}