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

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

 更新時(shí)間:2013年02月09日 19:46:37   作者:  
expect自動(dòng)檢測并重啟另外一臺服務(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)文章

最新評論

南投县| 普格县| 镇安县| 昌邑市| 佛学| 海口市| 方城县| 陵川县| 宝山区| 蓬莱市| 文昌市| 揭西县| 东城区| 景东| 云和县| 扶余县| 石台县| 汝阳县| 甘谷县| 枞阳县| 阳东县| 岱山县| 娄烦县| 科技| 博湖县| 饶阳县| 库尔勒市| 四平市| 尼木县| 石林| 桂林市| 登封市| 定襄县| 八宿县| 亳州市| 南宫市| 高雄县| 临朐县| 昌黎县| 惠来县| 陵水|