📄 ibmrsa.in
字号:
#!/bin/sh## Copyright (c) 2006 Dejan Muhamedagic <dmuhamedagic@at.ibm.com>, IBM Austria## External STONITH module for IBM RSA adapters.# External STONITH module for IBM BMC.# This STONITH module depends on IBMmpcli.## See# http://www-307.ibm.com/pc/support/site.wss/MIGR-54214.html# and# http://www.redbooks.ibm.com/abstracts/sg246495.html# for documentation about IBM management processors and the# IBMmpcli utility.# ##DEBUGF=/var/log/ha-ibmrsa.log#touch $DEBUGF#chmod 600 $DEBUGF#exec 2>>$DEBUGF#function debug() {# cat >&2#}#echo "started with: $@" | debugHA_VARRUNDIR=/var/run/heartbeatoutf=$HA_VARRUNDIR/ibmrsa-$$touch $outfif [ ! -f $outf ]then echo "cannot create temporary file $outf" exit 1fitrap "cat $outf >&2; rm -f $outf" EXITfunction chkmpcli() { test -x /opt/IBMmpcli/bin/MPCLI.sh}function mpcli() { chkmpcli || { echo "IBM mpcli not installed" return 1 } if [ x = "x$ipaddr" -o x = "x$userid" -o x = "x$passwd" ] then echo "ipaddr, userid, or passwd missing; check configuration" return 1 fi type=${type:-"ibm"} test -f /etc/ha.d/ibmrsa.debug && set -x goodstg="SUCCESS" failstg="FAILURE" ( echo "logonip -h $ipaddr -u $userid -p $passwd -t $type" echo "outputfile $outf" cat ) | /opt/IBMmpcli/bin/MPCLI.sh | grep -w $goodstg >/dev/null 2>&1 rc=$? grep -w $failstg $outf test $rc -eq 0 -a $? -eq 1}function ibmrsa_reboot() { echo restart -now | mpcli}function ibmrsa_poweron() { echo poweron | mpcli}function ibmrsa_poweroff() { echo poweroff | mpcli}function ibmrsa_status() { echo | mpcli}case $1 ingethosts) echo $hostname ;;on) ibmrsa_poweron ;;off) ibmrsa_poweroff ;;reset) ibmrsa_reboot ;;status) ibmrsa_status ;;getconfignames) for i in hostname ipaddr userid passwd type; do echo $i done ;;getinfo-devid) echo "IBM MP STONITH device" ;;getinfo-devname) echo "IBM MP STONITH device" ;;getinfo-devdescr) echo "IBM MP host reboot/poweron/poweroff" ;;getinfo-devurl) echo "http://www.ibm.com" ;;getinfo-xml) cat <<EOF<parameters><parameter name="hostname" unique="1"><content type="string" /><shortdesc lang="en">Hostname</shortdesc><longdesc lang="en">The hostname of the host to be managed by this STONITH device</longdesc></parameter><parameter name="ipaddr" unique="1"><content type="string" /><shortdesc lang="en">IP Address</shortdesc><longdesc lang="en">The IP address of the STONITH device</longdesc></parameter><parameter name="userid" unique="1"><content type="string" /><shortdesc lang="en">Login</shortdesc><longdesc lang="en">The username used for logging in to the STONITH device</longdesc></parameter><parameter name="passwd" unique="1"><content type="string" /><shortdesc lang="en">Password</shortdesc><longdesc lang="en">The password used for logging in to the STONITH device</longdesc></parameter><parameter name="type"><content type="string" /><shortdesc lang="en">Management processor type</shortdesc><longdesc lang="en">The type of the management processor. Possible values are"ibm" (default, typically used for RSA) and "ipmi"(for IPMI compliant processors such as BMC).</longdesc></parameter></parameters>EOF ;;*) exit 1 ;;esac
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -