This is the part of the resource agent that actually executes when the resource agent is invoked. It typically follows a fairly standard structure:
# Make sure meta-data and usage always succeed
case $__OCF_ACTION in
meta-data) foobar_meta_data
exit $OCF_SUCCESS
;;
usage|help) foobar_usage
exit $OCF_SUCCESS
;;
esac
# Anything other than meta-data and usage must pass validation
foobar_validate_all || exit $?
# Translate each action into the appropriate function call
case $__OCF_ACTION in
start) foobar_start;;
stop) foobar_stop;;
status|monitor) foobar_monitor;;
promote) foobar_promote;;
demote) foobar_demote;;
reload) ocf_log info "Reloading..."
foobar_start
;;
validate-all) ;;
*) foobar_usage
exit $OCF_ERR_UNIMPLEMENTED
;;
esac
rc=$?
# The resource agent may optionally log a debug message
ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION returned $rc"
exit $rc