expect安装以及进程查杀重启
来源:互联网 发布:djay pro 破解版 mac 编辑:程序博客网 时间:2024/06/01 20:39
进程部分参考:http://blog.csdn.net/yuanxuran0101/article/details/5548205
需求是这样:需要远程交互linux,重启一个程序
首先是expect安装:
892 tar -zxvf tcl8.4.20-src.tar.gz
893 cd tcl8.4.20
894 cd unix/
895 ./configure
896 make && make install
897 cd ../../
898 ll
899 tar -zxvf expect5.45.3.tar.gz
900 cd expect5.45.3
902 ./configure --with-tclinclude=/data01/tool/encrypt/tcl8.4.20/generic --with-tclconfig=/usr/local/lib/
903 make && make install
904 expect
896 ln -s /usr/local/bin/expect /usr/bin/expect
然后是进程查杀和重启
#!/usr/bin/expect
set server_name [lindex $argv 0]
spawn ssh root@100.100.114.185
expect {
#"yes/no" { send "yes\n";exp_continue }
"password" { send "123456\n" }
}
expect "]#"
send {kill `ps -ef | grep encrypt-decrypt-1.0.0_v1026.jar | grep -v grep | awk '{print $2}'`}
send "\n"
expect "]#"
send {echo program has bean killed}
send "\n"
expect "]#"
sleep 3
send {setsid java -jar encrypt-decrypt-1.0.0_v1026.jar}
send "\n"
expect eof
- expect安装以及进程查杀重启
- 安装expect
- expect安装
- 安装expect
- expect 安装
- expect 安装
- expect安装
- expect安装
- 安装expect
- expect安装
- expect安装
- expect 安装
- linux下expect环境安装以及简单脚本测试
- linux下expect环境安装以及简单脚本测试
- linux自动交互工具expect,tcl安装和安装包,以及自动互信脚本
- 安装 Tcl 和 Expect
- Fedora安装Expect
- linux下安装expect
- 《高性能iOS 应用开发》之降低你 APP 的电量消耗
- tomcat源码解读一 Digester的解析方式
- window.onload()函数解析
- 如何理解 4G LTE 网络不能承载语音通话,只能提供数据服务?
- mysql explain type
- expect安装以及进程查杀重启
- 容易被大多数人忽视的STM32串口DMA问题
- solr5以上版本配置到tomcat运行
- Centos6.9 安装zabbix-server
- Effective C++ 44. Factor parameter-independent code out of templates
- zookeeper+kafka+storm+flume 环境搭建
- java电子商务源码 b2b2c o2o
- 引用返回
- 阿里云公网访问Redis