diff --git a/heartbeat/MailTo b/heartbeat/MailTo index 921411ccb..cea6dd9ce 100644 --- a/heartbeat/MailTo +++ b/heartbeat/MailTo @@ -1,209 +1,215 @@ #!/bin/sh # # Resource script for MailTo # # Author: Alan Robertson # # Description: sends email to a sysadmin whenever a takeover occurs. # # Note: This command requires an argument, unlike normal init scripts. # # This can be given in the haresources file as: # # You can also give a mail subject line or even multiple addresses # MailTo::alanr@unix.sh::BigImportantWebServer # MailTo::alanr@unix.sh,spoppi@gmx.de::BigImportantWebServer # # This will then be put into the message subject and body. # # OCF parameters are as below: # OCF_RESKEY_email # OCF_RESKEY_subject # # License: GNU General Public License (GPL) # # Copyright: (C) 2005 International Business Machines ####################################################################### # Initialization: . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ####################################################################### ARGS="$0 $*" us=`uname -n` usage() { echo "Usage: $0 {start|stop|status|monitor|meta-data|validate-all}" } meta_data() { cat < 1.0 This is a resource agent for MailTo. It sends email to a sysadmin whenever a takeover occurs. MailTo resource agent The email address of sysadmin. Email address The subject of the email. Subject END } MailProgram() { $MAILCMD -s "$1" "$email" </dev/null if [ $? -eq 0 ]; then : OK, mail to $item@localhost.localdomain else ocf_log err "Invalid email address [$email]" exit $OCF_ERR_ARGS fi ;; esac done # Any subject is OK return $OCF_SUCCESS } # # See how we were called. # # The order in which heartbeat provides arguments to resource # scripts is broken. It should be fixed. # if ( [ $# -ne 1 ] ) then usage exit $OCF_ERR_GENERIC fi case $1 in meta-data) meta_data exit $OCF_SUCCESS ;; status|monitor) MailToStatus exit $? ;; usage) usage exit $OCF_SUCCESS ;; *) ;; esac if [ -z "$OCF_RESKEY_email" ] then ocf_log err "At least 1 Email address has to be given!" # usage exit $OCF_ERR_GENERIC fi email=$OCF_RESKEY_email subject=$OCF_RESKEY_subject +MailToValidateAll + case $1 in start) MailToStart ;; stop) MailToStop ;; - validate-all) MailToValidateAll - ;; + validate-all) ;; *) usage exit $OCF_ERR_UNIMPLEMENTED ;; esac exit $?