#!/bin/sh if [ -z "$1" ] || [ "$1" = "-h" ]; then echo "rcons - remotely accesses the serial console of a node" echo "rcons [conserver] [-f]" echo "rcons [-h|--help|-v|--version]" exit 0 fi if [ "$1" = "-v" ]; then echo "Version 2.1" exit 0 fi if [ -n "$3" ] && [ "$3" = "-f" ]; then FORCE=-f CONSERVER=$2 fi if [ -n "$2" ] && [ "$2" = "-f" ]; then FORCE=-f fi if [ -z "$CONSERVER" ]; then CONSERVER=$XCATHOST fi if [ -z "$CONSERVER" ]; then CONSERVER=localhost fi #NOTE: IPv6 is not good with the below if going by IP, needs more sophisticated #parsing CONSERVER=`echo $CONSERVER|cut -d: -f 1` #NOTE: on SuSE(at least SLES11), SSL is not complied in the application "console"; #so SuSE doesn't need the configuration in the file .consolerc if [ ! -f /etc/SuSE-release ]; then if [ ! -f $HOME/.consolerc ]; then echo 'config * {' > $HOME/.consolerc echo " port 782;" >> $HOME/.consolerc echo " sslenabled yes;" >> $HOME/.consolerc echo " sslauthority $HOME/.xcat/ca.pem;" >> $HOME/.consolerc echo " sslcredentials $HOME/.xcat/client-cred.pem;" >> $HOME/.consolerc echo '}' >> $HOME/.consolerc fi fi exec console $FORCE -M $CONSERVER $1