blob: e06d3dd6d8dede7548ae899df0da39eabf6ccef3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <csignal>
#include <unistd.h>
#include <vespa/log/log.h>
LOG_SETUP("vespa-logforwarder-start");
#include "cf-handler.h"
#include "sig-catch.h"
class Wrapper {
const char *_configId;
public:
Wrapper(const char *cfid) : _configId(cfid) {}
void run() {
SigCatch catcher;
CfHandler handler;
handler.start(_configId);
while (! catcher.receivedStopSignal()) {
handler.check();
usleep(12500); // Avoid busy looping;
}
}
};
int
main(int argc, char** argv)
{
int c = getopt(argc, argv, "c:");
if (c != 'c') {
LOG(error, "Usage: %s -c <config-id>", argv[0]);
exit(EXIT_FAILURE);
}
Wrapper wrapper(optarg);
wrapper.run();
return 0;
}
|