#!/bin/sh . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ME=NONEXISTENT OTHER=NONEXISTENT [ -f "${OCF_RESKEY_config}" ] && . "${OCF_RESKEY_config}" do_metadata() { cat << EOF 1.0 Updates DNS record relay for a failover address. DNS updater Configuration file, specifying addresses of the systems and hostname. Configuration file. Hostname associated with the DNS record. Hostname. EOF } do_usage() { echo "usage: $0 {start|stop|monitor|reload|meta-data|validate-all}" } do_monitor() { if grep -q "$ME.*$OCF_RESKEY_hostname" /etc/hosts then return $OCF_SUCCESS fi return $OCF_NOT_RUNNING } do_start() { grep -v "$OCF_RESKEY_hostname" /etc/hosts > /etc/hosts.new echo "$ME $OCF_RESKEY_hostname" >> /etc/hosts.new mv /etc/hosts.new /etc/hosts return $OCF_SUCCESS } do_stop() { grep -v "$OCF_RESKEY_hostname" /etc/hosts > /etc/hosts.new echo "$OTHER $OCF_RESKEY_hostname" >> /etc/hosts.new mv /etc/hosts.new /etc/hosts return $OCF_SUCCESS } case $__OCF_ACTION in meta-data) do_metadata exit $OCF_SUCCESS ;; monitor) do_monitor ;; start) do_start ;; stop) do_stop ;; *) do_usage exit $OCF_ERR_UNIMPLEMENTED ;; esac rc=$? ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" exit $rc