Commit 9ca0b4ce authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Move linktest startup to rc.linktest where it handles start/stop

arguments, passes keyfile name, pidfile name, logfile name, etc.
parent cb9e5232
......@@ -92,6 +92,7 @@ local-script-install: common-script-install
$(INSTALL) -m 755 $(SRCDIR)/rc.testbed $(BINDIR)/rc.testbed
$(INSTALL) -m 755 $(SRCDIR)/rc.agents $(BINDIR)/rc.agents
$(INSTALL) -m 755 $(SRCDIR)/rc.progagent $(BINDIR)/rc.progagent
$(INSTALL) -m 755 $(SRCDIR)/rc.linktest $(BINDIR)/rc.linktest
$(INSTALL) -m 755 $(SRCDIR)/rc.setup $(BINDIR)/rc.setup
$(INSTALL) -m 755 $(SRCDIR)/rc.slothd $(BINDIR)/rc.slothd
# Symlink this cause we invoke it from boss, and its too much
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
sub usage()
{
print "Usage: rc.linktest start | stop\n";
exit(1);
}
my $optlist = "";
my $action = "start";
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use libsetup;
use libtmcc;
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
%options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (@ARGV) {
$action = $ARGV[0];
usage()
if ($action ne "start" and $action ne "stop");
}
my $logfile = "$LOGDIR/linktest.debug";
my $pidfile = "/var/run/linktest.pid";
# Stop.
if ($action eq "stop") {
if (-e $pidfile) {
system("kill `cat $pidfile`");
# Does not unlink its own pidfile!
unlink($pidfile);
}
exit(0);
}
#
# Need the keyfile. We talk to the elvind on boss, not locally.
#
my $boss = tmccbossname();
my $keyfile = TMEVENTKEY();
#
# Need the pid/eid.
#
my ($pid, $eid, $vname) = check_nickname();
#
# Start the daemon.
#
system("linktest -e $pid/$eid -s $boss -l $logfile -i $pidfile -k $keyfile");
exit($? >> 0);
......@@ -126,15 +126,9 @@ fi
#
# Start the linktest daemon. It talks to the elvind on boss also.
#
if [ ! -x $BOOTDIR/rc.delay -a -x $BINDIR/linktest -a -r $BOOTDIR/nickname ]; then
if [ ! -x $BOOTDIR/rc.delay -a -x $BINDIR/rc.linktest ]; then
echo "Starting linktest daemon ..."
# XXX find our boss IP.
if [ -r $BOOTDIR/bossip ]; then
BOSSIP=`cat $BOOTDIR/bossip`
else
BOSSIP=`$BINDIR/tmcc bossinfo | awk '{print $2}'`
fi
$BINDIR/linktest -s $BOSSIP -e `cat $BOOTDIR/nickname | awk -F. '{print $3"/"$2}'`
$BINDIR/rc.linktest start
fi
if [ -x $BINDIR/rc.agents ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment