linux shell脚本登录远程执行命令,交互通过脚本
2015-10-22 16:17
477 查看
expect -c "
set timeout 15
spawn ssh root@172.16.17.34
expect *password* { send ××××××\r }
expect \"]#\"
send \"cd /\r\"
send \"tar jxvf name.tar.bz2\r\"
expect \"]#\"
send \"cd /name/cswap\r\"
send \"./stop-all.sh\r\"
expect \"]#\"
send \"./start-all.sh\r\"
expect \"*]#*\"
send \"exit\r\"
expect eof;"
set timeout 15
spawn ssh root@172.16.17.34
expect *password* { send ××××××\r }
expect \"]#\"
send \"cd /\r\"
send \"tar jxvf name.tar.bz2\r\"
expect \"]#\"
send \"cd /name/cswap\r\"
send \"./stop-all.sh\r\"
expect \"]#\"
send \"./start-all.sh\r\"
expect \"*]#*\"
send \"exit\r\"
expect eof;"
相关文章推荐
- linux shell脚本获取git代码
- shell 字符串
- sed提取被其它字符包围的ip地址
- Shell Scipt 命令行带参数,输出log
- shell更改目录编码
- shellter介绍
- 【shell】防止脚本重复运行
- 【shell】/etc/bashrc、~/.bashrc、~/.bash_profile的区别和作用
- 【shell】脚本中if条件的判断
- 手动清除内存shell【root权限】
- linux shell — 5.文件和目录管理(2)
- shell编程基本概念及其变量类型
- C# Interactive Shell
- Android adb shell常用命令
- shell脚本操作mysql数据库
- shell 2>&1的用法
- ShopEX 4.8.5.81822 前台Getshell
- shell Unversal framework修复方案
- 2013年工作中用到的10个命令:1-10
- 05_03 bash