8 #include "daq/expreco/EventServerCallback.h"
23 void* RunEventServerLogger(
void*)
25 s_eventserver->EventServerLogger();
32 EventServerCallback::EventServerCallback()
37 m_conf =
new RFConf(getenv(
"ERECO_CONFFILE"));
42 EventServerCallback::~EventServerCallback() noexcept
47 void EventServerCallback::load(
const DBObject&)
51 char* nodename = m_conf->getconf(
"eventsampler",
"server",
"nodename");
52 string execdir = string(m_conf->getconf(
"system",
"execdir_base")) +
"/eventserver";
53 printf(
"execdir = %s\n", execdir.c_str());
55 mkdir(execdir.c_str(), 0755);
56 chdir(execdir.c_str());
66 char* server = m_conf->getconf(
"eventsampler",
"server",
"script");
67 char* rbuf = m_conf->getconf(
"eventsampler",
"ringbufout");
68 char* port = m_conf->getconf(
"eventsampler",
"server",
"port");
69 m_pid_server = m_proc->Execute(server, rbuf, port);
74 pthread_attr_t thread_attr;
75 pthread_attr_init(&thread_attr);
79 pthread_create(&m_logthread, NULL, RunEventServerLogger, NULL);
83 void EventServerCallback::start()
87 void EventServerCallback::stop()
91 void EventServerCallback::abort()
95 if (m_pid_server != 0) {
96 kill(m_pid_server, SIGINT);
97 waitpid(m_pid_server, &status, 0);
98 LogFile::info(
"killed event server (pid=%d)", m_pid_server);
101 pthread_cancel(m_logthread);
105 void EventServerCallback::recover(
const DBObject&)
110 void EventServerCallback::EventServerLogger()
113 int st = m_proc->CheckOutput();
115 perror(
"EventServerLogger::server");
118 m_log->ProcessLog(m_proc->GetFd());
Abstract base class for different kinds of events.