iDRAC/console.sh

67 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
display_help() {
echo "Usage: $0 [-i host] [-u user] [-p password]"
echo
echo "Environment Variables:"
echo " IDRAC_ADDRESS"
echo " IDRAC_USER"
echo " IDRAC_PASSWORD"
echo " SOCKS_PROXY"
}
while [ $# -gt 0 ]; do
case "$1" in
-h)
display_help
exit 0
;;
-i)
shift
IDRAC_ADDRESS="$1"
;;
-u)
shift
IDRAC_USER="$1"
;;
-p)
shift
IDRAC_PASSWORD="$1"
;;
*)
display_help >&2
exit 2
;;
esac
shift
done
while [ -z "$IDRAC_ADDRESS" ]; do
echo -n 'Host: '
if ! read IDRAC_ADDRESS; then
exit 1
fi
done
while [ -z "$IDRAC_USER" ]; do
echo -n 'User: '
if ! read IDRAC_USER; then
exit 1
fi
done
while [ -z "$IDRAC_PASSWORD" ]; do
echo -n 'Password: '
if ! read -s IDRAC_PASSWORD; then
exit 1
fi
echo
done
if [ -z "${SOCKS_PROXY}" ]
then
java -cp avctKVM.jar -Djava.library.path=./lib com.avocent.idrac.kvm.Main ip="$IDRAC_ADDRESS" vmprivilege=true kmport=5900 vport=5900 user="$IDRAC_USER" passwd="$IDRAC_PASSWORD" apcp=1 version=2
else
java -cp avctKVM.jar -Djava.library.path=./lib -DsocksProxyHost=$SOCKS_PROXY com.avocent.idrac.kvm.Main ip="$IDRAC_ADDRESS" vmprivilege=true kmport=5900 vport=5900 user="$IDRAC_USER" passwd="$IDRAC_PASSWORD" apcp=1 version=2
fi