📄 mailto.in
字号:
#!/bin/sh## Resource script for MailTo## Author: Alan Robertson <alanr@unix.sh>## 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.## License: GPLARGS="$0 $*"# Source function library.prefix=@prefix@exec_prefix=@exec_prefix@. @sysconfdir@/ha.d/shellfuncsus=`uname -n`usage() { echo "Usage: $0 <email> [subject] {start|stop|status}" echo "$Id: MailTo.in,v 1.1 2004/08/27 09:34:14 lars Exp $" exit 1}MailProgram() { @MAILCMD@ -s "$1" "$email" <<EOF $Subject Command line was: $ARGSEOF}SubjectLine() { case $1 in ??*) echo $1;; *) echo "Resource Group";; esac}MailToStart() { Subject="`SubjectLine $subject` Takeover in progress on $us" MailProgram "$Subject" $1}MailToStop () { Subject="`SubjectLine $subject` Migrating resource away from $us" MailProgram "$Subject" $1}# # See how we were called.## The order in which heartbeat provides arguments to resource# scripts is broken. It should be fixed.#case "$#" in 0|1) echo "At least 1 Email address has to be given!" usage ;; 2) email=$1 cmd=$2 subject="" ;; 3) email=$1 cmd=$3 subject=$2 ;; *) echo "Additional parameters found: $# but max. 3 are allowed!" usage;;esaccase "$cmd" in start) MailToStart ;; stop) MailToStop ;; # Not quite sure what to do with this one... # We aren't a continuously running service - so it's not clear # status) echo "stopped" ;; *) usage ;;esacexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -