最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

expect自動檢測并重啟另外一臺服務(wù)器上的程序代碼

 更新時間:2013年02月09日 19:46:37   作者:  
expect自動檢測并重啟另外一臺服務(wù)器上的程序的代碼,有需要的朋友可以參考下

[s005 you] # cat haproxy_expect

復(fù)制代碼 代碼如下:

#!/usr/bin/expect
set ssh_user "fivetrees"
set password "123456"
spawn ssh -i /root/.ssh/$ssh_user Server004.xd.com
expect_before "no)?" {
send "yes\r" }
sleep 0.5
expect "Enter passphrase for key*"
send "$password\r"
expect "*#"
send "/tmp/haproxy.sh\r"
expect "*#"
send "echo\r"
exit

[s004 him] # cat haproxy.sh

復(fù)制代碼 代碼如下:

#!/bin/bash
Thread=`ps -ef | grep haproxy | grep -v haproxy.sh | grep -v grep`
if [ -z "$Thread" ]
then
        /tmp/haproxy_expect
fi

[s004 him] # cat haproxy_expect

復(fù)制代碼 代碼如下:

#!/usr/bin/expect
set ssh_user "fivetrees"
set password "123456"
spawn ssh -i /root/.ssh/$ssh_user Server005.xd.com
expect_before "no)?" {
send "yes\r" }
sleep 0.5
expect "Enter passphrase for key*"
send "$password\r"
expect "*#"
send "/usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/haproxy.cfg\r"
expect "*#"
send "echo\r"
exit

相關(guān)文章

最新評論

轮台县| 海门市| 周宁县| 长治市| 北宁市| 内江市| 江西省| 景德镇市| 营口市| 海丰县| 沙田区| 武冈市| 河池市| 彰化市| 滦平县| 应城市| 乐平市| 集安市| 宁夏| 宁河县| 鞍山市| 郯城县| 济源市| 仁怀市| 武胜县| 孟津县| 教育| 新源县| 海丰县| 交城县| 桑日县| 东乡族自治县| 遂宁市| 怀宁县| 资阳市| 宁城县| 茶陵县| 皋兰县| 乐陵市| 衡阳县| 六盘水市|