diff --git a/heartbeat/Dummy.in b/heartbeat/Dummy.in index b00be7ed0..92f510505 100644 --- a/heartbeat/Dummy.in +++ b/heartbeat/Dummy.in @@ -1,223 +1,158 @@ #!/bin/sh # # # Dummy OCF RA. Does nothing but wait a few seconds, can be # configured to fail occassionally. # # Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Brée # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License # along with this program; if not, write the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # ####################################################################### # Initialization: . @hb_libdir@/ocf-shellfuncs ####################################################################### meta_data() { cat < 1.0 -This is a Dummy Resource Agent. It does absolutely nothing except wait -for various amounts of time on execution. +This is a Dummy Resource Agent. It does absolutely nothing except +keep track of whether its running or not. +Its purpose in life is for testing and to serve as a template for RA writers. Dummy resource agent - - -How long to delay before each action. - -Action delay - - - Location to store the resource state in. State file - - - - - -Complain loudly if they try to run us in parallel on the same resource. - -Report error if run twice at the same time - - - - - -Process the TERM signal and don't exit. - -No TERM ain't gonna kill us. - - - - - -Print more information. - -Be verbose. - + END } ####################################################################### # don't exit on TERM, to test that lrmd makes sure that we do exit +trap sigterm_handler TERM sigterm_handler() { ocf_log info "They use TERM to bring us down. No such luck." return } dummy_usage() { cat </dev/null - then - ocf_log err "There is another instance of ${OCF_RESOURCE_INSTANCE} running: pid `cat $lockf`." - exit $OCF_ERR_GENERIC - fi -} - -[ "$OCF_RESKEY_check_parallel" = 1 ] && - check4parallel - -[ "$OCF_RESKEY_ignore_TERM" = 1 ] && - trap sigterm_handler TERM - -echo $$ > $lockf -trap "rm -f $lockf" EXIT -verbose && invocation $@ +: ${OCF_RESKEY_state=@HA_VARRUNHBRSCDIR@/Dummy-${OCF_RESOURCE_INSTANCE}.state} case $__OCF_ACTION in meta-data) meta_data exit $OCF_SUCCESS ;; start) dummy_start;; stop) dummy_stop;; monitor) dummy_monitor;; migrate_to) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_to}." dummy_stop ;; migrate_from) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrated_from}." dummy_start ;; reload) ocf_log err "Reloading..." dummy_start ;; validate-all) dummy_validate;; usage|help) dummy_usage exit $OCF_SUCCESS ;; *) dummy_usage exit $OCF_ERR_UNIMPLEMENTED ;; esac rc=$? ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" exit $rc