source: fedkit/federate.sh @ 63f7c7e

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since 63f7c7e was 63f7c7e, checked in by Ted Faber <faber@…>, 17 years ago

add hosts fixup

  • Property mode set to 100755
File size: 1.6 KB
Line 
1#!/bin/sh
2
3BOSSNODE="/usr/local/etc/emulab/bossnode"
4# GATEWAY="detertunnel"
5
6PORTS="139 7777"
7NC="/usr/bin/nc"
8RCDIR="/usr/local/etc/emulab/rc"
9
10RCACCT="rc.accounts"
11SMBMOUNT="smbmount.pl"
12
13if [ -f $BOSSNODE ]
14then
15        rm -f $BOSSNODE
16fi
17
18EMUDIR="/usr/local/etc/emulab/"
19
20# Find this experiment's stashed scripts.  (Perl for advanced parsing)
21SCRIPTDIR=`$EMUDIR/tmcc -b status | perl -ne '/ALLOCATED=([^\/]+)\/([^\s]+)/ && print "/proj/$1/exp/$2/tmp\n";'`
22
23# Die if things are weird
24if [ -z "$SCRIPTDIR" ] ; then
25    echo "Can't find federation scripts.  Tmcc status says:"
26    $EMUDIR/tmcc -b status
27    exit 1;
28fi
29
30# Move the SMB mounting script out of NFS so we can call it after the umount
31cp "$SCRIPTDIR/$SMBMOUNT" /tmp
32
33# Copy the global hostnames file into /etc/hosts so this node can address
34# others in the experiment on other testbeds.
35grep 127\\.0\\.0\\.1 /etc/hosts > /tmp/hosts
36cat "$SCRIPTDIR/hosts" >> /tmp/hosts
37cp /tmp/hosts /etc/hosts && rm /tmp/hosts
38
39GATEWAY=`$EMUDIR/tmcc -b syncserver | awk ' { match($0, /SERVER=[^[:space:]]+/); print substr($0,RSTART+8,RLENGTH-9);}'`
40
41#
42# Spin on our gateway!
43#
44
45echo "Waiting for the tunnel to come online."
46
47for port in $PORTS
48do
49        until $NC -z $GATEWAY $port
50        do
51                sleep 5
52        done
53done
54
55#
56# Setup TMCC to use our gateway
57#
58
59echo "Configuring TMCC."
60
61$EMUDIR/sethostname
62
63echo $GATEWAY > $BOSSNODE
64
65
66#
67# Unmount stuff before messing with accounts
68#
69umount -A -f -t nfs,smbfs
70
71
72#
73# Setup new accounts
74#
75$RCDIR/rc.accounts reconfig
76
77#
78# Copy and exec the smbmount perl script
79#
80
81echo "Mounting via SMB."
82
83exec "/tmp/$SMBMOUNT"
Note: See TracBrowser for help on using the repository browser.