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

Kill off tevd. It is no longer used, so one less daemon running on boss.

parent 6cb712c1
......@@ -11,9 +11,6 @@ SUBDIR = event/tbgen
SYSTEM := $(shell uname -s)
PROGRAMS = tevc
ifneq ($(SYSTEM),Linux)
PROGRAMS += tevd tevd.restart
endif
include $(OBJDIR)/Makeconf
......@@ -55,15 +52,9 @@ tevc: tevc.o $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o
$(CC) $(LDFLAGS) -static -o $@ tevc.o $(LIBTBDIR)/log.o \
$(LIBTBDIR)/tbdefs.o $(LIBS)
tevd: tevd.o
$(CC) $(LDFLAGS) -o $@ tevd.o \
-L/usr/local/lib/mysql -lmysqlclient -ltb $(LIBS)
$(PROGRAMS): ../lib/libevent.a ../lib/event.h
install: $(INSTALL_SBINDIR)/tevd \
$(INSTALL_SBINDIR)/tevd.restart \
$(INSTALL_BINDIR)/tevc
install: $(INSTALL_BINDIR)/tevc
control-install: $(INSTALL_BINDIR)/tevc
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* All rights reserved.
*/
/*
* This is used to send Testbed Control Event Daemon. Its purpose
* is to handle TBCONTROL events.
*
* TODO: Needs to be daemonized.
*/
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "event.h"
#include "log.h"
#include "tbdb.h"
static char *progname;
static int debug = 0;
void
usage()
{
fprintf(stderr, "Usage: %s [-s server] [-p port]\n",
progname);
exit(-1);
}
static void
callback(event_handle_t handle,
event_notification_t notification, void *data);
int
main(int argc, char **argv)
{
event_handle_t handle;
address_tuple_t tuple;
char *server = NULL;
char *port = NULL;
char buf[BUFSIZ];
int c;
progname = argv[0];
while ((c = getopt(argc, argv, "s:p:d")) != -1) {
switch (c) {
case 'd':
debug = 1;
break;
case 's':
server = optarg;
break;
case 'p':
port = optarg;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
if (debug)
loginit(0, 0);
else {
loginit(1, "tevd");
/* See below for daemonization */
}
/*
* Set up DB state.
*/
if (!dbinit())
return 1;
/*
* Convert server/port to elvin thing.
*
* XXX This elvin string stuff should be moved down a layer.
*/
if (server) {
snprintf(buf, sizeof(buf), "elvin://%s%s%s",
server,
(port ? ":" : ""),
(port ? port : ""));
server = buf;
}
/*
* Construct an address tuple for generating the event.
*/
tuple = address_tuple_alloc();
if (tuple == NULL) {
fatal("could not allocate an address tuple");
}
tuple->objtype = OBJECTTYPE_TESTBED;
/* Register with the event system: */
handle = event_register(server, 0);
if (handle == NULL) {
fatal("could not register with event system");
}
/* Subscribe to the test event: */
if (! event_subscribe(handle, callback, tuple, "event received")) {
fatal("could not subscribe to event");
}
/*
* Do this now, once we have had a chance to fail on the above
* event system calls.
*/
if (!debug)
daemon(0, 0);
/* Begin the event loop, waiting to receive event notifications: */
event_main(handle);
/* Unregister with the event system: */
if (event_unregister(handle) == 0) {
fatal("could not unregister with event system");
}
return 0;
}
/*
* Handle Testbed Control events.
*/
static void
callback(event_handle_t handle, event_notification_t notification, void *data)
{
char nodeid[TBDB_FLEN_NODEID];
char eventtype[TBDB_FLEN_EVEVENTTYPE];
char ipaddr[32];
event_notification_get_sender(handle, notification,
ipaddr, sizeof(ipaddr));
event_notification_get_eventtype(handle, notification,
eventtype, sizeof(eventtype));
/*
* Convert to nodeid.
*/
if (! mydb_iptonodeid(ipaddr, nodeid)) {
error("Could not map ipaddr %s to nodeid!", ipaddr);
return;
}
/*
* Set the event status for this node.
*/
if (! mydb_setnodeeventstate(nodeid, eventtype)) {
error("Error setting node event state: %s/%s!",
nodeid, eventtype);
return;
}
info("%s(%s) -> %s", ipaddr, nodeid, eventtype);
}
#!/bin/csh
set TBDIR=@prefix@
killall tevd
exec ${TBDIR}/sbin/tevd >>& $TBDIR/log/tevd.log
......@@ -117,7 +117,7 @@ my @MOUNTPOINTS = ("$PREFIX/usersvar", "$PREFIX/opsdir",
my @LOGFILES = ("$LOGDIR/bootinfo.log", "$LOGDIR/tmcd.log",
"$LOGDIR/capture.log", "$LOGDIR/dhcpd.log", "$LOGDIR/capserver.log",
"$LOGDIR/frisbeed.log", "$LOGDIR/tevd.log", "$LOGDIR/proxydhcpd.log",
"$LOGDIR/frisbeed.log", "$LOGDIR/proxydhcpd.log",
"$LOGDIR/elvind.log", "$LOGDIR/stated.log", "$LOGDIR/osselect.log",
"$LOGDIR/tftpd.log", "$LOGDIR/sdcollectd.log", "$LOGDIR/genlastlog.log",
"$LOGDIR/sshxmlrpc.log", "$LOGDIR/plabgetfree.log", "$LOGDIR/xmlrpcbag.log"
......@@ -311,7 +311,6 @@ Phase "syslog", "Setting up syslog", sub {
"!tftpd", "*.*\t\t\t\t\t\t$LOGDIR/tftpd.log",
"!capserver", "*.*\t\t\t\t\t\t$LOGDIR/capserver.log",
"!frisbeed", "*.*\t\t\t\t\t\t$LOGDIR/frisbeed.log",
"!tevd", "*.*\t\t\t\t\t\t$LOGDIR/tevd.log",
"!elvind", "*.*\t\t\t\t\t\t$LOGDIR/elvind.log",
"!stated", "*.*\t\t\t\t\t\t$LOGDIR/stated.log",
"!osselect", "*.*\t\t\t\t\t\t$LOGDIR/osselect.log",
......@@ -362,7 +361,6 @@ Phase "syslog", "Setting up syslog", sub {
"$LOGDIR/bootinfo.log 640 7 200 * Z",
"$LOGDIR/capserver.log 640 5 200 * Z",
"$LOGDIR/elvind.log 640 5 1000 * Z",
"$LOGDIR/tevd.log 640 3 200 * Z",
"$LOGDIR/suexec.log 640 3 200 * Z",
"$LOGDIR/genlastlog.log 640 3 200 * Z",
"$LOGDIR/genlastlog 640 3 200 * Z " .
......
......@@ -24,11 +24,6 @@ case "$1" in
@prefix@/sbin/tmcd.restart
fi
if [ -x @prefix@/sbin/tevd.restart ]; then
echo -n " tevd"
@prefix@/sbin/tevd.restart
fi
if [ -x @prefix@/sbin/capserver ]; then
echo -n " capd"
@prefix@/sbin/capserver
......
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