root / trunk / shell / generate-hosts-file @ 39
Historique | Voir | Annoter | Télécharger (1,76 ko)
| 1 |
#! /bin/bash |
|---|---|
| 2 |
# |
| 3 |
# ST - 2012-05-15 |
| 4 |
# |
| 5 |
# Create and start the front end. |
| 6 |
# |
| 7 |
# Get the directory of the script. |
| 8 |
SCRIPT_PATH=`dirname $0` |
| 9 |
# Get the script name. |
| 10 |
SCRIPT_NAME=`basename $0` |
| 11 |
# Source the common configuration variables. |
| 12 |
. $SCRIPT_PATH/c-i-a-b.common |
| 13 |
# |
| 14 |
# Output file stuff: we write all the output to file descriptor #5 |
| 15 |
# If no argument is given to the script descriptor #5 is redirected to |
| 16 |
# STDOUT (descriptor #1) |
| 17 |
# If an argument is given, output is rediected to the file having |
| 18 |
# the name of the argument. |
| 19 |
# |
| 20 |
if [ "x$1" == "x" ] ; then |
| 21 |
exec 5>&1 |
| 22 |
else |
| 23 |
exec 5> $1 |
| 24 |
fi |
| 25 |
# Localhost stuff. |
| 26 |
echo "127.0.0.1 localhost" 1>&5 |
| 27 |
# Compute nodes stuff. |
| 28 |
CNCSNP=1 |
| 29 |
for CNCSNP in `seq 1 $CONST_COMPUTE_NODE_MAX_NUM` ; do |
| 30 |
echo -n "${CLUSTER_STATIC_NETWORK_PREFIX}.${CNCSNP} " 1>&5
|
| 31 |
CNCSNP_STRING=$CNCSNP |
| 32 |
while [ ${#CNCSNP_STRING} -lt 3 ] ; do
|
| 33 |
CNCSNP_STRING=0$CNCSNP_STRING |
| 34 |
done |
| 35 |
echo -n "${COMPUTE_NODE_NAME_PREFIX}${CNCSNP_STRING}.${CLUSTER_DOMAIN_NAME} " 1>&5
|
| 36 |
echo "${COMPUTE_NODE_NAME_PREFIX}${CNCSNP_STRING}" 1>&5
|
| 37 |
done |
| 38 |
# Front-end stuff. |
| 39 |
echo -n "${CLUSTER_STATIC_NETWORK_PREFIX}.${CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX} " 1>&5
|
| 40 |
echo -n "${FRONT_END_HOST_NAME}.${CLUSTER_DOMAIN_NAME} " 1>&5
|
| 41 |
echo "$FRONT_END_CLUSTER_HOST_NAME" 1>&5 |
| 42 |
# Compute node model stuff. |
| 43 |
echo -n "${CLUSTER_STATIC_NETWORK_PREFIX}.${CONST_COMPUTE_NODE_MODEL_CLUSTER_STATIC_NETWORK_POSTFIX} " 1>&5
|
| 44 |
echo -n "${COMPUTE_NODE_MODEL_HOST_NAME}.${CLUSTER_DOMAIN_NAME} " 1>&5
|
| 45 |
echo "$COMPUTE_NODE_MODEL_CLUSTER_HOST_NAME" 1>&5 |
| 46 |
# |
| 47 |
# IPv6 stuff |
| 48 |
echo "#" 1>&5 |
| 49 |
echo "# The following lines are desirable for IPv6 capable hosts" 1>&5 |
| 50 |
echo "::1 ip6-localhost ip6-loopback" 1>&5 |
| 51 |
echo "fe00::0 ip6-localnet" 1>&5 |
| 52 |
echo "ff00::0 ip6-mcastprefix" 1>&5 |
| 53 |
echo "ff02::1 ip6-allnodes" 1>&5 |
| 54 |
echo "ffO2::2 ip6-allrouters" 1>&5 |
| 55 |
exec 5>&- |
| 56 |
exit 0 |