X7ROOT File Manager
Current Path:
/usr/lib/ocf/resource.d/heartbeat
usr
/
lib
/
ocf
/
resource.d
/
heartbeat
/
📁
..
📄
.ocf-binaries
(1.57 KB)
📄
.ocf-directories
(674 B)
📄
.ocf-returncodes
(1.83 KB)
📄
.ocf-shellfuncs
(25.02 KB)
📄
CTDB
(31.3 KB)
📄
Delay
(4.66 KB)
📄
Dummy
(5.25 KB)
📄
Filesystem
(24.59 KB)
📄
IPaddr
(35.5 KB)
📄
IPaddr2
(35.5 KB)
📄
IPsrcaddr
(15.02 KB)
📄
LVM
(11.87 KB)
📄
LVM-activate
(23.81 KB)
📄
MailTo
(3.9 KB)
📄
NodeUtilization
(7.82 KB)
📄
Route
(10.23 KB)
📄
SendArp
(6.78 KB)
📄
Squid
(10.56 KB)
📄
VirtualDomain
(34.78 KB)
📄
Xinetd
(5.74 KB)
📄
aliyun-vpc-move-ip
(8.52 KB)
📄
apache
(17.55 KB)
📄
aws-vpc-move-ip
(13.1 KB)
📄
aws-vpc-route53
(13.92 KB)
📄
awseip
(8.25 KB)
📄
awsvip
(7.05 KB)
📄
azure-events
(29.34 KB)
📄
azure-lb
(5.43 KB)
📄
clvm
(11 KB)
📄
conntrackd
(9.52 KB)
📄
db2
(24.36 KB)
📄
dhcpd
(18.67 KB)
📄
docker
(16.78 KB)
📄
ethmonitor
(17.04 KB)
📄
exportfs
(12.25 KB)
📄
galera
(30.37 KB)
📄
garbd
(12.09 KB)
📄
iSCSILogicalUnit
(25.1 KB)
📄
iSCSITarget
(22.4 KB)
📄
iface-vlan
(13.13 KB)
📄
lvmlockd
(9.81 KB)
📄
mysql
(35 KB)
📄
nagios
(7.12 KB)
📄
named
(13.71 KB)
📄
nfsnotify
(8.91 KB)
📄
nfsserver
(19.7 KB)
📄
nginx
(22 KB)
📄
oraasm
(4.07 KB)
📄
oracle
(19.37 KB)
📄
oralsnr
(6.49 KB)
📄
pgsql
(67.2 KB)
📄
portblock
(14.97 KB)
📄
postfix
(11.18 KB)
📄
rabbitmq-cluster
(17.64 KB)
📄
redis
(21.47 KB)
📄
rsyncd
(5.88 KB)
📄
slapd
(13.84 KB)
📄
sybaseASE
(28.85 KB)
📄
symlink
(8.37 KB)
📄
tomcat
(22.39 KB)
📄
vdo-vol
(5.51 KB)
Editing: MailTo
#!/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. # # 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_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs ####################################################################### ARGS="$0 $*" us=`uname -n` usage() { echo "Usage: $0 {start|stop|status|monitor|meta-data|validate-all}" } meta_data() { cat <<END <?xml version="1.0"?> <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd"> <resource-agent name="MailTo"> <version>1.0</version> <longdesc lang="en"> This is a resource agent for MailTo. It sends email to a sysadmin whenever a takeover occurs. </longdesc> <shortdesc lang="en">Notifies recipients by email in the event of resource takeover</shortdesc> <parameters> <parameter name="email" unique="0" required="1"> <longdesc lang="en"> The email address of sysadmin. </longdesc> <shortdesc lang="en">Email address</shortdesc> <content type="string" default="" /> </parameter> <parameter name="subject" unique="0"> <longdesc lang="en"> The subject of the email. </longdesc> <shortdesc lang="en">Subject</shortdesc> <content type="string" default="" /> </parameter> </parameters> <actions> <action name="start" timeout="10s" /> <action name="stop" timeout="10s" /> <action name="status" depth="0" timeout="10s" interval="10s" /> <action name="monitor" depth="0" timeout="10s" interval="10s" /> <action name="meta-data" timeout="5s" /> <action name="validate-all" timeout="5s" /> </actions> </resource-agent> END } MailProgram() { $MAILCMD -s "$1" "$email" <<EOF $Subject Command line was: $ARGS EOF return $? } SubjectLine() { case $1 in ??*) echo "$@";; *) echo "Resource Group";; esac } MailToStart() { Subject="`SubjectLine $subject` Takeover in progress at `date` on $us" MailProgram "$Subject" $1 ha_pseudo_resource MailTo_${OCF_RESOURCE_INSTANCE} start } MailToStop () { Subject="`SubjectLine $subject` Migrating resource away at `date` from $us" MailProgram "$Subject" $1 ha_pseudo_resource MailTo_${OCF_RESOURCE_INSTANCE} stop } MailToStatus () { # ocf_log warn "Don't stat/monitor me! MailTo is a pseudo resource agent, so the status reported may be incorrect" if ha_pseudo_resource MailTo_${OCF_RESOURCE_INSTANCE} monitor then echo "running" return $OCF_SUCCESS else echo "stopped" return $OCF_NOT_RUNNING fi } MailToValidateAll () { if [ -z "$MAILCMD" ]; then ocf_exit_reason "MAILCMD not set: complain to the packager" exit $OCF_ERR_INSTALLED fi check_binary "$MAILCMD" 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_exit_reason "At least 1 Email address has to be given!" exit $OCF_ERR_CONFIGURED fi email=$OCF_RESKEY_email subject=$OCF_RESKEY_subject MailToValidateAll case $1 in start) MailToStart ;; stop) MailToStop ;; validate-all) ;; *) usage exit $OCF_ERR_UNIMPLEMENTED ;; esac exit $?
Upload File
Create Folder