Keepalived_vrrp: Unable to access script `[[`

在Centos 7中配置如下:

yum install keepalive -y
版本:
Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2

vrrp_script chk_down {
script"[[ -f /etc/keepalived/down ]] && exit 1 || exit 0"
interval 1
weight -2
}

track_script {
chk_down
}

touch /etc/keepalived/down #无法手动切换主从

查看日志
Keepalived_vrrp[9772]: Unable to access script [[
Dec 5 05:06:18 node71 Keepalived_vrrp[9772]: Disabling track script chk_down since not found

解决:
vrrp_script chk_down {
#script "[[ -f /etc/keepalived/down ]] && exit 1 || exit 0"
script "/etc/keepalived/keep_down.sh"
interval 1
}

cat etc/keepalived/keep_down.sh
#!/bin/bash
if [ -f /etc/keepalived/down ];then
weight -2
fi

VRRP script(s)

Adds a script to be executed periodically. Its exit code will be

    # recorded for all VRRP instances which are monitoring it.
    vrrp_script <SCRIPT_NAME> {
       script <STRING>|<QUOTED-STRING> # path of the script to execute
       interval <INTEGER>  # seconds between script invocations, default 1 second
       timeout <INTEGER>   # seconds after which script is considered to have failed
       weight <INTEGER:-254..254>  # adjust priority by this weight, default 0
       rise <INTEGER>              # required number of successes for OK transition
       fall <INTEGER>              # required number of successes for KO transition
       user USERNAME [GROUPNAME]   # user/group names to run script under
                                   #   group default to group of user
       init_fail                   # assume script initially is in failed state
    }

转载于:https://blog.51cto.com/shadowhk/2047662

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值