aboutsummaryrefslogtreecommitdiff
blob: 71782e956751ff46d2c43fd90fdde4ca8182819b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

C3CONF=./c3.conf
TMP=/tmp/$0-$$
NODES=${TMP}_NODES

exec > $TMP

shopt -s xpg_echo

echo "# This files was automatically created by $PWD/$0 and shouldn't be manually modified unless $0 is disabled." 
echo "# This file descriptor is inefficient for the sake of code simplicity"

# define the cluster
echo "cluster gentoo {"

# The master node is the first one to be defined...we are the master node:
echo "\t$HOSTNAME"

# Extract the pre-defined nodes from the existing file
egrep -v -e"({|}|#|$HOSTNAME)" $C3CONF > $NODES
echo "\t$4" >> $NODES
cat $NODES | sort -g

# End of config file:
echo "}"

mv $TMP $C3CONF 

rm -f $NODES