f54ff4ccd4
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10438 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
31 lines
1006 B
Bash
Executable File
31 lines
1006 B
Bash
Executable File
#!/bin/bash
|
|
if [ -z "$XCATDEST" ]; then
|
|
XCATDEST=$1
|
|
fi
|
|
echo "<xcatrequest>
|
|
<command>getdestiny</command>
|
|
<callback_port>300</callback_port>
|
|
</xcatrequest>" > /tmp/destreq.xml
|
|
rm /tmp/destreq.xml
|
|
while [ ! -f /tmp/destreq.xml ] || grep error /tmp/destiny.xml; do
|
|
if [ -f /tmp/destreq.xml ]; then
|
|
timer=60
|
|
while [ $timer -gt 0 ]; do
|
|
echo -en "Retrying in $timer seconds \r"
|
|
sleep 1
|
|
timer=$(($timer-1));
|
|
done
|
|
fi
|
|
echo -en " \r";
|
|
if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available
|
|
cat /tmp/destreq.xml | openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml
|
|
else
|
|
cat /tmp/destreq.xml | openssl s_client -connect $XCATDEST -quiet 2> /dev/null > /tmp/destiny.xml
|
|
fi
|
|
done
|
|
rm /tmp/destreq.xml
|
|
DESTINY=`grep destiny /tmp/destiny.xml | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
|
|
rm /tmp/destiny.xml
|
|
echo $DESTINY
|
|
|