diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-11-25 16:20:27 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-11-25 16:20:27 +0100 |
commit | e845a4188b93a31445a780ae11f33286420cb038 (patch) | |
tree | 31aecf769c262c1ac639b71bfd381c7e2122f51c /src/DabMux.cpp | |
parent | 939abd61fc10cb8df2ecdc6d92764bb3ea5b41a7 (diff) | |
download | dabmux-e845a4188b93a31445a780ae11f33286420cb038.tar.gz dabmux-e845a4188b93a31445a780ae11f33286420cb038.tar.bz2 dabmux-e845a4188b93a31445a780ae11f33286420cb038.zip |
Add startupcheck functionality
Diffstat (limited to 'src/DabMux.cpp')
-rw-r--r-- | src/DabMux.cpp | 20 |
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) ); |