Add commandline arguments to console.sh
This commit is contained in:
parent
764c4e8d19
commit
450932fe40
66
console.sh
66
console.sh
@ -1,18 +1,66 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -n 'Host: '
|
||||
read drachost
|
||||
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"
|
||||
}
|
||||
|
||||
echo -n 'User: '
|
||||
read dracuser
|
||||
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
|
||||
|
||||
echo -n 'Password: '
|
||||
read -s dracpass
|
||||
echo
|
||||
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=$drachost vmprivilege=true kmport=5900 vport=5900 user=$dracuser passwd=$dracpass apcp=1 version=2
|
||||
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=$drachost vmprivilege=true kmport=5900 vport=5900 user=$dracuser passwd=$dracpass apcp=1 version=2
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user