diff options
author | Alan Conway <aconway@apache.org> | 2011-12-08 20:04:46 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2011-12-08 20:04:46 +0000 |
commit | 3ac2506bbc32af882f81311cc64053f5823191a1 (patch) | |
tree | 234097755d6d706cf3f198037521a64ac0d66964 /cpp/src | |
parent | 632b12bf08a91ae876bc397fd8d20ad3aabe6d03 (diff) | |
download | qpid-python-3ac2506bbc32af882f81311cc64053f5823191a1.tar.gz |
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
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/cluster/WatchDogPlugin.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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<std::string>(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); } |