drac: Open virtual console on iDRAC6.

This commit is contained in:
Ole Tange 2020-07-21 17:33:19 +02:00
parent ec48e1066d
commit ef093d815d
2 changed files with 146 additions and 14 deletions

View file

@ -1,19 +1,19 @@
CMD = blink 2grep 2search burncpu duplicate-packets em encdir field \ CMD = blink 2grep 2search burncpu drac duplicate-packets em encdir \
forever fxkill G gitnext gitundo goodpasswd histogram mtrr \ field forever fxkill G gitnext gitundo goodpasswd histogram \
mirrorpdf neno off parsort pdfman pidcmd pidtree plotpipe \ mtrr mirrorpdf neno off parsort pdfman pidcmd pidtree \
puniq ramusage rand rclean rina rn rrm seekmaniac shython \ plotpipe puniq ramusage rand rclean rina rn rrm seekmaniac \
sound-reload splitvideo stdout swapout T timestamp tracefile \ shython sound-reload splitvideo stdout swapout T timestamp \
transpose upsidedown vid w4it-for-port-open whitehash \ tracefile transpose upsidedown vid w4it-for-port-open \
wifi-reload wssh ytv yyyymmdd whitehash wifi-reload wssh ytv yyyymmdd
all: blink/blink.1 2search/2grep.1 2search/2search.1 \ all: blink/blink.1 2search/2grep.1 2search/2search.1 \
burncpu/burncpu.1 encdir/encdir.1 field/field.1 G/G.1 \ burncpu/burncpu.1 drac/drac.1 encdir/encdir.1 field/field.1 \
gitnext/gitnext.1 gitundo/gitundo.1 goodpasswd/goodpasswd.1 \ G/G.1 gitnext/gitnext.1 gitundo/gitundo.1 \
histogram/histogram.1 mirrorpdf/mirrorpdf.1 neno/neno.1 \ goodpasswd/goodpasswd.1 histogram/histogram.1 \
off/off.1 parsort/parsort.1 pdfman/pdfman.1 pidcmd/pidcmd.1 \ mirrorpdf/mirrorpdf.1 neno/neno.1 off/off.1 parsort/parsort.1 \
pidtree/pidtree.1 plotpipe/plotpipe.1 puniq/puniq.1 \ pdfman/pdfman.1 pidcmd/pidcmd.1 pidtree/pidtree.1 \
rand/rand.1 rina/rina.1 rn/rn.1 rrm/rrm.1 \ plotpipe/plotpipe.1 puniq/puniq.1 rand/rand.1 rina/rina.1 \
seekmaniac/seekmaniac.1 shython/shython.1 \ rn/rn.1 rrm/rrm.1 seekmaniac/seekmaniac.1 shython/shython.1 \
sound-reload/sound-reload.1 splitvideo/splitvideo.1 \ sound-reload/sound-reload.1 splitvideo/splitvideo.1 \
stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 \ stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 \
transpose/transpose.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \ transpose/transpose.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \

132
drac/drac Executable file
View file

@ -0,0 +1,132 @@
#!/bin/bash
: <<=cut
=pod
=head1 NAME
drac - Connect to iDRAC6 virtual console
=head1 SYNOPSIS
B<pdfman> I<manentry>
B<drac> [[I<user>[:I<password>]@]I<host>]
=head1 DESCRIPTION
B<drac> downloads the .jar file from the iDRAC6 and runs it with Java.
=head1 OPTIONS
=over 12
=item I<host>
I<host> defaults to $DRAC_HOST, which defaults to 'drac'.
=item I<user>
I<user> defaults to $DRAC_USER, which defaults to 'root'.
=item I<passwd>
I<passwd> defaults to $DRAC_PASSWD, which defaults to calvin.
=back
=head1 EXAMPLES
Connect to the drac server 'drac' using 'root/calvin':
drac
Connect to the drac server 'mydrac' using 'myroot/joe':
drac myroot:joe@mydrac
Connect to the drac server 'mydrac' using 'myroot/joe':
DRAC_HOST=mydrac
DRAC_USER=myroot
DRAC_PASSWD=joe
drac
=head1 AUTHOR
Copyright (C) 2020 Ole Tange,
http://ole.tange.dk and Free Software Foundation, Inc.
=head1 LICENSE
Copyright (C) 2012 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
=head1 DEPENDENCIES
B<pdfman> uses B<man> and B<ps2pdf>.
=head1 SEE ALSO
B<java>
=cut
read host user passwd < <(echo "$1" |
perl -pe 's/^(?:(.*?)(?::(.*?))?@)?(.*?)$/$3 $1 $2/')
if [ "$user" = "" ] ; then
DRAC_USER=${DRAC_USER:-root}
else
DRAC_USER="$user"
fi
if [ "$passwd" = "" ] ; then
DRAC_PASSWD=${DRAC_PASSWD:-calvin}
else
DRAC_PASSWD="$passwd"
fi
if [ "$host" = "" ] ; then
DRAC_HOST=${DRAC_HOST:-drac}
else
DRAC_HOST="$host"
fi
tmp=`tempfile`
get=$(
(lynx -source /dev/null && echo lynx -source) ||
(fetch -o /dev/null file:///bin/sh && echo fetch -o -) ||
(curl -h >/dev/null && echo curl -L) ||
(wget -h >/dev/null && echo wget -qO -) ||
echo 'No lynx, wget, curl, fetch: Please file a bug report with which tool you use for downloading URLs' >&2
)
$get http://"$DRAC_HOST"/software/avctKVM.jar > "$tmp"
(sleep 3; rm "$tmp") &
java -cp "$tmp" com.avocent.idrac.kvm.Main \
user="$DRAC_USER" passwd="$DRAC_PASSWD" ip="$DRAC_HOST" \
kmport=5900 vport=5900 apcp=1 version=2 vmprivilege=true \
"helpurl=https://$DRAC_HOST:443/help/contents.html"