2008-01-10 01:59:16 +00:00
|
|
|
#!/bin/sh
|
2008-10-31 15:01:50 +00:00
|
|
|
if [ $1 = -h ]; then
|
|
|
|
echo "rcons - remotely accesses the serial console of a node"
|
|
|
|
echo "rcons <singlenode>"
|
2009-04-24 10:33:09 +00:00
|
|
|
echo "rcons <singlenode> [conserver] [-f]"
|
2008-10-31 15:01:50 +00:00
|
|
|
echo "rcons [-h|--help|-v|--version]"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
if [ $1 = -v ]; then
|
|
|
|
echo "Version 2.1"
|
|
|
|
exit 0
|
|
|
|
fi
|
2009-04-24 10:33:09 +00:00
|
|
|
|
|
|
|
if [ -n "$3" ] && [ "$3" = "-f" ]; then
|
|
|
|
FORCE=-f
|
|
|
|
CONSERVER=$2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$2" ] && [ "$2" = "-f" ]; then
|
|
|
|
FORCE=-f
|
|
|
|
fi
|
|
|
|
|
2008-02-01 16:23:20 +00:00
|
|
|
if [ -z "$CONSERVER" ]; then
|
2008-01-10 01:59:16 +00:00
|
|
|
CONSERVER=$XCATHOST
|
|
|
|
fi
|
2008-02-01 16:23:20 +00:00
|
|
|
if [ -z "$CONSERVER" ]; then
|
2008-01-10 01:59:16 +00:00
|
|
|
CONSERVER=localhost
|
|
|
|
fi
|
2008-01-10 02:02:57 +00:00
|
|
|
#NOTE: IPv6 is not good with the below if going by IP, needs more sophisticated
|
|
|
|
#parsing
|
|
|
|
CONSERVER=`echo $CONSERVER|cut -d: -f 1`
|
2008-01-10 01:59:16 +00:00
|
|
|
if [ ! -f $HOME/.consolerc ]; then
|
|
|
|
echo 'config * {' > $HOME/.consolerc
|
2008-01-11 21:34:25 +00:00
|
|
|
echo " port 782;" >> $HOME/.consolerc
|
|
|
|
echo " sslenabled yes;" >> $HOME/.consolerc
|
2008-01-10 01:59:16 +00:00
|
|
|
echo " sslauthority $HOME/.xcat/ca.pem;" >> $HOME/.consolerc
|
|
|
|
echo " sslcredentials $HOME/.xcat/client-cred.pem;" >> $HOME/.consolerc
|
|
|
|
echo '}' >> $HOME/.consolerc
|
|
|
|
fi
|
2009-04-24 10:33:09 +00:00
|
|
|
|
|
|
|
exec console $FORCE -M $CONSERVER $1
|