[3c7da22] | 1 | #!/bin/sh |
---|
| 2 | |
---|
[9d207bd] | 3 | # find perl |
---|
| 4 | if [ -x "/usr/bin/perl" ]; then |
---|
| 5 | PERL="/usr/bin/perl" |
---|
| 6 | else |
---|
| 7 | if [ -x "/usr/local/bin/perl" ]; then |
---|
| 8 | PERL="/usr/local/bin/perl" |
---|
| 9 | else |
---|
| 10 | # Wing it... |
---|
| 11 | PERL="perl" |
---|
| 12 | fi |
---|
| 13 | fi |
---|
| 14 | |
---|
| 15 | # Find this experiment's stashed scripts. (Perl for advanced parsing) |
---|
| 16 | EMUDIR="/usr/local/etc/emulab/" |
---|
| 17 | PROJECT=`$EMUDIR/tmcc -b status | $PERL -ne '/ALLOCATED=([^\/]+)\/([^\s]+)/ && print "$1\n";'` |
---|
| 18 | EXP=`$EMUDIR/tmcc -b status | $PERL -ne '/ALLOCATED=([^\/]+)\/([^\s]+)/ && print "$2\n";'` |
---|
[9c166cf] | 19 | CONFIGDIR="/proj/$PROJECT/exp/$EXP/tmp" |
---|
| 20 | SCRIPTDIR="/usr/local/federation/bin" |
---|
[9d207bd] | 21 | |
---|
[3c7da22] | 22 | # Very simple script to copy the global hosts file over the local one |
---|
| 23 | # while preserving the localhost entry. Run on DETER master clients |
---|
| 24 | |
---|
| 25 | grep 127\\.0\\.0\\.1 /etc/hosts > /tmp/hosts |
---|
| 26 | cat $1 >> /tmp/hosts |
---|
| 27 | cp /tmp/hosts /etc/hosts && rm /tmp/hosts |
---|
[e06b224] | 28 | |
---|
[7add1a3] | 29 | # Find the right version of pkill. For killing. |
---|
| 30 | if [ -x "/usr/bin/pkill" ] ; then |
---|
| 31 | PKILL="/usr/bin/pkill" |
---|
| 32 | else |
---|
| 33 | if [ -x "/bin/pkill" ] ; then |
---|
| 34 | PKILL="/bin/pkill" |
---|
| 35 | else |
---|
| 36 | PKILL="echo" |
---|
[f778038] | 37 | fi |
---|
| 38 | fi |
---|
| 39 | |
---|
[9d207bd] | 40 | # XXX: modified seer daemon to read a config file. Not in the tarfile yet. If |
---|
| 41 | # we see one, and there's a /usr/seer/backend/daemon.py, replace that one with |
---|
| 42 | # the local one. |
---|
| 43 | if [ -e /usr/seer/backend/daemon.py ] && [ -e $SCRIPTDIR/daemon.py ]; then |
---|
| 44 | /bin/cp $SCRIPTDIR/daemon.py /usr/seer/backend/daemon.py |
---|
| 45 | fi |
---|
| 46 | |
---|
| 47 | if [ -e /usr/seer/backend/experiment-setup.py ] && [ -e $SCRIPTDIR/experiment-setup.py ]; then |
---|
| 48 | /bin/cp $SCRIPTDIR/experiment-setup.py /usr/seer/backend/experiment-setup.py |
---|
| 49 | fi |
---|
| 50 | |
---|
| 51 | # Copy the seer.conf to the local /tmp if there is one |
---|
| 52 | |
---|
[9c166cf] | 53 | if [ -e $CONFIGDIR/seer.conf ]; then |
---|
| 54 | /bin/cp $CONFIGDIR/seer.conf /tmp |
---|
[9d207bd] | 55 | fi |
---|
| 56 | |
---|
| 57 | |
---|
[7c3008e] | 58 | # SEER feels pain and confusion if times are wrong. This lays a big lick on |
---|
| 59 | # ntp sets the time directly and then restarts it. XXX FreeBSD incantation is |
---|
| 60 | # untested. |
---|
| 61 | |
---|
| 62 | case `uname` in |
---|
| 63 | "FreeBSD") |
---|
| 64 | /etc/rc.d/ntpd stop |
---|
| 65 | /usr/sbin/ntpdate boss |
---|
| 66 | /etc/rc.d/ntpd start |
---|
| 67 | ;; |
---|
| 68 | "Linux") |
---|
| 69 | /etc/rc.d/init.d/ntpd stop |
---|
| 70 | /usr/sbin/ntpdate boss |
---|
| 71 | /etc/rc.d/init.d/ntpd start |
---|
| 72 | ;; |
---|
| 73 | esac |
---|
[7add1a3] | 74 | # I remain unclear why ospfd seems screwed up after the resetting of accounts |
---|
| 75 | # and mounts. This seems to fix it, but it's not very satisfying. At this |
---|
| 76 | # point the federated topology is complete, so any problems with routing in a |
---|
| 77 | # partial topology -e.g. failed or partial bridging - that might have confused |
---|
| 78 | # the router should be gone. |
---|
| 79 | $PKILL ospf |
---|
| 80 | $PKILL gated |
---|
| 81 | |
---|
| 82 | # XXX Danger, hack ahead. Apparently our FC6-SMB image and emulab disagree |
---|
| 83 | # about where gated lives. This will alias it. |
---|
| 84 | if [ ! -x /usr/sbin/gated ] ; then |
---|
| 85 | if [ -x /sbin/gated ] ; then |
---|
| 86 | ln /sbin/gated /usr/sbin/gated |
---|
| 87 | fi |
---|
| 88 | fi |
---|
| 89 | /usr/local/etc/emulab/rc/rc.route |
---|
| 90 | |
---|
[7c3008e] | 91 | |
---|
| 92 | # Execute any command passed in as a startcmd. This basically daisy chains the |
---|
| 93 | # startcmd. This needs to become a perl script to have uniform behavior here. |
---|
| 94 | echo "*$2* *$3*" |
---|
[e06b224] | 95 | if [ ! -z "$2" ]; then |
---|
[7c3008e] | 96 | echo "calling *$2* *$3*" |
---|
| 97 | case `uname` in |
---|
| 98 | "FreeBSD") |
---|
| 99 | su -l "$2" -c "$3" |
---|
| 100 | ;; |
---|
| 101 | "Linux") |
---|
| 102 | su "$2" --command="$3" |
---|
| 103 | ;; |
---|
| 104 | esac |
---|
[e06b224] | 105 | fi |
---|