jmton 发表于 2018-12-28 11:54:35

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: Unable to access script [[
Dec5 05:06:18 node71 Keepalived_vrrp: 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
}
  catetc/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 | # path of the script to execute
interval   # seconds between script invocations, default 1 second
timeout    # seconds after which script is considered to have failed
weight   # adjust priority by this weight, default 0
rise               # required number of successes for OK transition
fall               # required number of successes for KO transition
user USERNAME    # user/group names to run script under
#   group default to group of user
init_fail                   # assume script initially is in failed state
}


页: [1]
查看完整版本: Keepalived_vrrp: Unable to access script `[[`