source: fedkit/federate.sh @ 3c7da22

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

Parameterize federate.sh and smbmount.pl (several parameters were hard wired)

make_hosts runs on deter nodes when DETER is the master testbed. It puts
all the federated hosts into /etc/hosts

  • Property mode set to 100755
File size: 1.9 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
39# Get our gateway, share, and mount user from the configuration file.
40# There's probably a way to get all three at once, but this works.
41GATEWAY=`perl -ne '/ControlGateway:\s+(.*)/i && print "$1\n";' $SCRIPTDIR/client.conf`
42SHARE=`perl -ne '/SMBShare:\s+(.*)/i && print "$1\n";' $SCRIPTDIR/client.conf`
43SMBUSER=`perl -ne '/ProjectUser:\s+(.*)/i && print "$1\n";' $SCRIPTDIR/client.conf`
44
45#
46# Spin on our gateway!
47#
48
49echo "Waiting for the tunnel to come online."
50
51for port in $PORTS
52do
53        until $NC -z $GATEWAY $port
54        do
55                sleep 5
56        done
57done
58
59#
60# Setup TMCC to use our gateway
61#
62
63echo "Configuring TMCC."
64
65$EMUDIR/sethostname
66
67echo $GATEWAY > $BOSSNODE
68
69
70#
71# Unmount stuff before messing with accounts
72#
73umount -A -f -t nfs,smbfs
74
75
76#
77# Setup new accounts
78#
79$RCDIR/rc.accounts reconfig
80
81#
82# Copy and exec the smbmount perl script
83#
84
85echo "Mounting via SMB."
86
87exec "/tmp/$SMBMOUNT" $SHARE $SMBUSER $GATEWAY
Note: See TracBrowser for help on using the repository browser.