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 | 03ccf0933506f98e4c829d546eba65b2b6f9b1f9 (patch) | |
| tree | ec370db9fe59a58f86fda850b611ba6668f45a61 /qpid/cpp | |
| parent | 3f5d23d77db83a9bc234a06a90e821a13c1ac37e (diff) | |
| download | qpid-python-03ccf0933506f98e4c829d546eba65b2b6f9b1f9.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@1212077 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
| -rw-r--r-- | qpid/cpp/src/qpid/cluster/WatchDogPlugin.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/cluster/WatchDogPlugin.cpp b/qpid/cpp/src/qpid/cluster/WatchDogPlugin.cpp index 57ba5cf2fd..f919041107 100644 --- a/qpid/cpp/src/qpid/cluster/WatchDogPlugin.cpp +++ b/qpid/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); } |
