#include "common/logging.h"
#include "common/reqid.h"
#include "common/sock_io.h"
+#include "common/path.h"
#include "protocol/protocol_api.h"
struct eventd_context {
struct tevent_context *ev;
const char *path;
- const char *script_dir;
- const char *pidfile;
const char *socket;
- const char *debug_hung_script;
/* server state */
pid_t eventd_pid;
struct eventd_context **out)
{
struct eventd_context *ectx;
- const char *eventd = CTDB_HELPER_BINDIR "/ctdb_eventd";
- const char *debug_hung_script = CTDB_ETCDIR "/debug-hung-script.sh";
+ const char *eventd = CTDB_HELPER_BINDIR "/ctdb-eventd";
const char *value;
- char *socket;
int ret;
ectx = talloc_zero(mem_ctx, struct eventd_context);
return false;
}
- ectx->script_dir = ctdb->event_script_dir;
-
- socket = talloc_strdup(ectx, ctdb_get_socketname(ctdb));
- if (socket == NULL) {
- talloc_free(ectx);
- return false;
- }
-
- ectx->socket = talloc_asprintf(ectx, "%s/eventd.sock",
- dirname(socket));
+ ectx->socket = path_socket(ectx, "eventd");
if (ectx->socket == NULL) {
talloc_free(ectx);
return false;
}
- talloc_free(socket);
-
- value = getenv("CTDB_DEBUG_HUNG_SCRIPT");
- if (value != NULL) {
- if (value[0] == '\0') {
- debug_hung_script = NULL;
- } else {
- debug_hung_script = value;
- }
- }
-
- if (debug_hung_script != NULL) {
- ectx->debug_hung_script = talloc_strdup(ectx,
- debug_hung_script);
- if (ectx->debug_hung_script == NULL) {
- talloc_free(ectx);
- return false;
- }
- }
-
ret = reqid_init(ectx, 1, &ectx->idr);
if (ret != 0) {
talloc_free(ectx);
return -1;
}
- argv = talloc_array(ectx, const char *, 14);
+ argv = talloc_array(ectx, const char *, 4);
if (argv == NULL) {
return -1;
}
argv[0] = ectx->path;
- argv[1] = "-e";
- argv[2] = ectx->script_dir;
- argv[3] = "-s";
- argv[4] = ectx->socket;
- argv[5] = "-P";
- argv[6] = talloc_asprintf(argv, "%d", ctdb->ctdbd_pid);
- argv[7] = "-l";
- argv[8] = getenv("CTDB_LOGGING");
- argv[9] = "-d";
- argv[10] = debug_level_to_string(DEBUGLEVEL);
- if (ectx->debug_hung_script == NULL) {
- argv[11] = NULL;
- argv[12] = NULL;
- } else {
- argv[11] = "-D";
- argv[12] = ectx->debug_hung_script;
- }
- argv[13] = NULL;
+ argv[1] = "-P";
+ argv[2] = talloc_asprintf(argv, "%d", ctdb->ctdbd_pid);
+ argv[3] = NULL;
- if (argv[6] == NULL) {
+ if (argv[2] == NULL) {
talloc_free(argv);
return -1;
}
DEBUG(DEBUG_NOTICE,
- ("Starting event daemon %s %s %s %s %s %s %s %s %s %s %s\n",
- argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8], argv[9], argv[10]));
+ ("Starting event daemon %s %s %s\n", argv[0], argv[1], argv[2]));
ret = pipe(fd);
if (ret != 0) {