#!/bin/sh ###################################################################### # power-toggle-vaj December 2005 # Horms horms@verge.net.au # # power-toggle-vaj # Change the power states on an APC Rack PDU APP # Copyright (C) 2005 Horms # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA # ###################################################################### ADDR="172.17.100.1" PORTS="1 2 7 8" usage () { echo "Usage: power-toggle-vaj status-all" >&2 echo " power-toggle-vaj PORT on|off|status" >&2 echo " e.g Usage power-toggle-vaj 8 status" >&2 exit 1 } if [ "$#" -eq 1 ]; then if [ "$1" != "status-all" ]; then usage fi for i in $PORTS; do echo -n "$i: " power-toggle "$ADDR" "$i" "$i" status done exit 0 fi if [ $# -ne 2 ]; then usage fi exec power-toggle "$ADDR" "$1" "$1" "$2"