source: fedkit/federate.sh @ d53dda5

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

startcmd that works with amd

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