From 946843ff59ab4c5d3751c55ee26d5dacfeaed27d Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 10 Jan 2017 03:01:59 +0100 Subject: [PATCH] feat(script): Configurable condition using exec-if Add new config parameter `exec-if = cmd` that needs to exit successfully before the main exec command will be invoked. Closes #298 --- include/modules/cmdscript.hpp | 1 + include/modules/script.hpp | 3 +++ include/modules/tailscript.hpp | 1 + src/modules/cmdscript.cpp | 9 +++------ src/modules/script.cpp | 23 +++++++++++++++++++++-- src/modules/tailscript.cpp | 14 ++++---------- 6 files changed, 33 insertions(+), 18 deletions(-) diff --git a/include/modules/cmdscript.hpp b/include/modules/cmdscript.hpp index 7968018c..3b2d2a5d 100644 --- a/include/modules/cmdscript.hpp +++ b/include/modules/cmdscript.hpp @@ -11,6 +11,7 @@ namespace modules { protected: void process(); + chrono::duration sleep_duration(); }; } diff --git a/include/modules/script.hpp b/include/modules/script.hpp index 92d54c80..ccfea03e 100644 --- a/include/modules/script.hpp +++ b/include/modules/script.hpp @@ -20,6 +20,7 @@ namespace modules { protected: virtual void process() = 0; + virtual chrono::duration sleep_duration() = 0; static constexpr const char* TAG_OUTPUT{""}; static constexpr const char* TAG_LABEL{"