📄 winpopup.in
字号:
#!/bin/sh## Resource script for sending WinPopups using smbclient# derived from Alan Robertson's MailTo script## Author: Sandro Poppi <spoppi@gmx.de>## Description: sends WinPopups to a sysadmin's workstation# whenever a takeover occurs.## Note: This command requires an argument, unlike normal init scripts.## This can be given in the haresources file as:## WinPopup::hosts## where "hosts" is a file containing the IPs/Workstation names# one by line to be sent WinPopups## License: GPLARGS="$0 $*"# Source function library.. @sysconfdir@/ha.d/shellfuncsus=`uname -n`usage() { echo "Usage: $0 [workstationfile] {start|stop|status}" echo "$Id: WinPopup.in,v 1.1 2004/08/27 09:34:14 lars Exp $" exit 1}sendWinPopup() { # if workstation file exists and is not zero if [ -s "$hostfile" ] ; then subject=$1 shift for i in `cat $hostfile` ; do echo "$subject $*" | smbclient -M $i >/dev/null 2>&1 done else logger -is -t HA-WinPopup "ERROR: Workstation file $hostfile missing or corrupt!" exit 2 fi}SubjectLine() { case $1 in ??*) echo $1;; *) echo "Resource Group";; esac}WinPopupStart() { Subject="`SubjectLine $2` Takeover in progress on $us" sendWinPopup "$Subject" $1}WinPopupStop () { Subject="`SubjectLine $2` Reestablishing original master connection in progress on $us" sendWinPopup "$Subject" $1}# max. 2 parameters allowedif [ $# -gt 2 ] ; then echo "Additional parameters found: $# but only 2 are allowed!" usagefi# See how we were called.if [ "$1" != "start" -a "$1" != "stop" ] ; then # optional parameter found cmd=$2 hostfile=$1else cmd=$1 hostfile="hosts"ficase "$cmd" in start) WinPopupStart ;; stop) WinPopupStop ;; # Not quite sure what to do with this one... status) echo "status not implemented yet" ;; *) usageesacexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -