source: fedkit/federate.sh @ 5166ad4

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

avoid running out of a directory we delete

  • 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
13# Find somewhere safe to stop
14cd /tmp
15
16if [ -f $BOSSNODE ]
17then
18        rm -f $BOSSNODE
19fi
20
21EMUDIR="/usr/local/etc/emulab/"
22
23# Find this experiment's stashed scripts.  (Perl for advanced parsing)
24SCRIPTDIR=`$EMUDIR/tmcc -b status | perl -ne '/ALLOCATED=([^\/]+)\/([^\s]+)/ && print "/proj/$1/exp/$2/tmp\n";'`
25
26# Die if things are weird
27if [ -z "$SCRIPTDIR" ] ; then
28    echo "Can't find federation scripts.  Tmcc status says:"
29    $EMUDIR/tmcc -b status
30    exit 1;
31fi
32
33# Move the SMB mounting script out of NFS so we can call it after the umount
34cp "$SCRIPTDIR/$SMBMOUNT" /tmp
35
36# Copy the global hostnames file into /etc/hosts so this node can address
37# others in the experiment on other testbeds.
38grep 127\\.0\\.0\\.1 /etc/hosts > /tmp/hosts
39cat "$SCRIPTDIR/hosts" >> /tmp/hosts
40cp /tmp/hosts /etc/hosts && rm /tmp/hosts
41
42# Get our gateway, share, and mount user from the configuration file.
43# There's probably a way to get all three at once, but this works.
44GATEWAY=`perl -ne '/ControlGateway:\s+(.*)/i && print "$1\n";' $SCRIPTDIR/client.conf`
45SHARE=`perl -ne '/SMBShare:\s+(.*)/i && print "$1\n";' $SCRIPTDIR/client.conf`
46SMBUSER=`perl -ne '/ProjectUser:\s+(.*)/i && print "$1\n";' $SCRIPTDIR/client.conf`
47
48#
49# Spin on our gateway!
50#
51
52echo "Waiting for the tunnel to come online."
53
54for port in $PORTS
55do
56        until $NC -z $GATEWAY $port
57        do
58                sleep 5
59        done
60done
61
62#
63# Setup TMCC to use our gateway
64#
65
66echo "Configuring TMCC."
67
68$EMUDIR/sethostname
69
70echo $GATEWAY > $BOSSNODE
71
72
73#
74# Unmount stuff before messing with accounts
75#
76umount -A -f -t nfs,smbfs
77
78
79#
80# Setup new accounts
81#
82$RCDIR/rc.accounts reconfig
83
84#
85# Copy and exec the smbmount perl script
86#
87
88echo "Mounting via SMB."
89
90exec "/tmp/$SMBMOUNT" $SHARE $SMBUSER $GATEWAY
Note: See TracBrowser for help on using the repository browser.