1 #! /bin/ksh 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the License). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/CDDL.txt 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/CDDL.txt. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets [] replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 23 # 24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25 # Use is subject to license terms. 26 # 27 28 #pragma ident "@(#)ping_plg_cmd.ksh 1.3 07/11/18 SMI" 29 30 # /usr/cluster/bin/ping_plg_cmd - Ping Plugin for GCHB 31 # In this we ignore the mode (normal/emergency) and do the same thing for 32 # both the modes. 33 34 PATH=/usr/bin:/bin:/sbin 35 36 # Get the various IPs specified 37 listips=`echo $3 | sed s/,/\ /g` 38 39 # Ping every given IP with the specified timeout - echo ERROR if unsuccesfull 40 # Pipe the output to grep and read the number of lines in a variable 41 for i in $listips 42 do 43 ( /usr/sbin/ping $i $1 >/dev/null 2>&1 || echo ERROR )& 44 done | grep "ERROR" | wc -l | read num 45 46 # If the num == the total number of IPs specified then error (1) 47 # else success (0) 48 set $listips 49 [[ $num -lt $# ]] || exit 1 50 exit 0 51