This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
publicnic
94 lines (69 loc) · 3.01 KB
/
publicnic
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
# ********************************************************************* #
# 5-thishost-finalize scripts are called with *this* node's IP, short #
# hostname and fully qualified hostname. They are called *after* #
# 4-restarts (as the numbering system implies). They are somewhat #
# esoteric, but can be useful if a local program depends on one of the #
# things restarted in 4-restarts. #
# ********************************************************************* #
RELDIR=`dirname $0`
ABSDIR=`cd $RELDIR; pwd`
echo "Hello from \"$ABSDIR/$0\""
# NOTE: The name of this script must correspond to the interface name that
# the context broker knows, not the local interface name which may or
# may not match.
#
# The context agent can only handle two NICs at most. By convention, if
# there is more than one NIC, the nics need to be labelled "publicnic" or
# "localnic" as defined by the metadata server. On EC2, the publicnic
# is the public IP address that NATs the VM (it does not correspond to
# an actual NIC in the VM). Note again that the labelling is NOT the
# interface name in the VM but rather the labels in the contextualization
# document where different roles may be played by different IP addresses
# (and they are labelled with NIC names).
echo "publicnic thishost finalize: configuring or launching something after restarts"
echo "This IP: $1"
echo "This short local hostname: $2"
echo "This FQDN: $3"
# We're overloading torque master role to imply other head node setups.
# Could do something explicit by way of the context roles too, but this
# works just fine (assuming torque master is always same node as GT).
if [ ! -e "/root/this_node_is_torque_master" ]; then
exit 0
fi
# cluster-001:
# Start postgresql before Globus
/etc/init.d/postgresql start
if [ $? -ne 0 ]; then
echo "problem starting postgresql"
exit 1
fi
# We have put a keyword everywhere that the local hostname needs to appear
# in the GT4 configs. This sed command replaces keyword with local FQDN.
REPLACEKEYWORD="THISHOST_REPLACE_FQDN"
GL="/opt/gt4"
function replace (){
echo "Adding local FQDN to: $2"
OUTPUTFILE=/root/safe/`uuidgen`
sed "s/$REPLACEKEYWORD/$1/g" $2 > $OUTPUTFILE
# Trick while you're setting contextualization up: manually call this
# script and run the sed replacement backwards,to get back to the replacement
# tokens before the image is --save'd back to the repository.
# sed "s/$1/$REPLACEKEYWORD/g" $2 > $OUTPUTFILE
cp $OUTPUTFILE $2
}
replace $3 $GL/etc/gram-service/jndi-config.xml
replace $3 $GL/etc/gram-service/globus_gram_fs_map_config.xml
replace $3 $GL/etc/globus-job-manager.conf
replace $3 $GL/etc/globus_wsrf_core/server-config.wsdd
replace $3 $GL/client-config.wsdd
# see 3-data/startcontainer
if [ ! -e "/root/do_startcontainer" ]; then
exit 0
fi
# Start GT container.
/etc/init.d/globus start
if [ $? -ne 0 ]; then
echo "problem starting globus container"
exit 1
fi