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