From 3ac2506bbc32af882f81311cc64053f5823191a1 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 8 Dec 2011 20:04:46 +0000 Subject: QPID-3669: Configuration option for path to watchdog executable. Added --watchdog-exec option to watchdog plugin to specify path to the qpidd_watchdog executable, so it can be installed in a non-standard place. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1212077 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/WatchDogPlugin.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/cluster/WatchDogPlugin.cpp b/cpp/src/qpid/cluster/WatchDogPlugin.cpp index 57ba5cf2fd..f919041107 100644 --- a/cpp/src/qpid/cluster/WatchDogPlugin.cpp +++ b/cpp/src/qpid/cluster/WatchDogPlugin.cpp @@ -55,8 +55,9 @@ namespace cluster { using broker::Broker; struct Settings { - Settings() : interval(0) {} + Settings() : interval(0), watchdogExec(QPID_LIBEXEC_DIR "/qpidd_watchdog") {} int interval; + std::string watchdogExec; }; struct WatchDogOptions : public qpid::Options { @@ -66,7 +67,9 @@ struct WatchDogOptions : public qpid::Options { addOptions() ("watchdog-interval", optValue(settings.interval, "N"), "broker is automatically killed if it is hung for more than \ - N seconds. 0 disables watchdog."); + N seconds. 0 disables watchdog.") + ("watchdog-exec", optValue(settings.watchdogExec, ""), + "Path to the qpidd_watchdog executable."); } }; @@ -114,11 +117,10 @@ struct WatchDogPlugin : public qpid::Plugin, public qpid::sys::Fork { protected: void child() { // Child of fork - const char* watchdog = ::getenv("QPID_WATCHDOG_EXEC"); // For use in tests - if (!watchdog) watchdog=QPID_LIBEXEC_DIR "/qpidd_watchdog"; std::string interval = boost::lexical_cast(settings.interval); - ::execl(watchdog, watchdog, interval.c_str(), NULL); - QPID_LOG(critical, "Failed to exec watchdog program " << watchdog ); + const char* watchdogExec = settings.watchdogExec.c_str(); + ::execl(watchdogExec, watchdogExec, interval.c_str(), NULL); + QPID_LOG(critical, "Failed to exec watchdog program " << watchdogExec); ::kill(::getppid(), SIGKILL); exit(1); } -- cgit v1.2.1