summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-11-25 16:20:27 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-11-25 16:20:27 +0100
commite845a4188b93a31445a780ae11f33286420cb038 (patch)
tree31aecf769c262c1ac639b71bfd381c7e2122f51c /src
parent939abd61fc10cb8df2ecdc6d92764bb3ea5b41a7 (diff)
downloaddabmux-e845a4188b93a31445a780ae11f33286420cb038.tar.gz
dabmux-e845a4188b93a31445a780ae11f33286420cb038.tar.bz2
dabmux-e845a4188b93a31445a780ae11f33286420cb038.zip
Add startupcheck functionality
Diffstat (limited to 'src')
-rw-r--r--src/DabMux.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 3ee57c0..de0c362 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -239,6 +239,26 @@ int main(int argc, char *argv[])
etiLog.register_backend(std::make_shared<LogToSyslog>());
}
+ const auto startupcheck = pt.get<string>("general.startupcheck", "");
+ if (not startupcheck.empty()) {
+ etiLog.level(info) << "Running startup check '" << startupcheck << "'";
+ int wstatus = system(startupcheck.c_str());
+
+ if (WIFEXITED(wstatus)) {
+ if (WEXITSTATUS(wstatus) == 0) {
+ etiLog.level(info) << "Startup check ok";
+ }
+ else {
+ etiLog.level(error) << "Startup check failed, returned " << WEXITSTATUS(wstatus);
+ return 1;
+ }
+ }
+ else {
+ etiLog.level(error) << "Startup check failed, child didn't terminate normally";
+ return 1;
+ }
+ }
+
int mgmtserverport = pt.get<int>("general.managementport",
pt.get<int>("general.statsserverport", 0) );