summaryrefslogtreecommitdiffstats
path: root/ctdb/server/eventscript.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2009-10-28 09:07:43 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2009-10-28 09:07:43 +1100
commit3526bc830dc9b86f1c6afa973fd06591eea240c3 (patch)
treeb0f405a56599d717cf5dda4951dee171f8ba289a /ctdb/server/eventscript.c
parent0588b5f9c55b4d539040492484d55d43eef7622f (diff)
downloadsamba-3526bc830dc9b86f1c6afa973fd06591eea240c3.tar.gz
samba-3526bc830dc9b86f1c6afa973fd06591eea240c3.tar.xz
samba-3526bc830dc9b86f1c6afa973fd06591eea240c3.zip
Enhance the logging fromeventscripts.
When a single script is finished, also log the name of the script, the duration it took and the return status. In the loop where we signal back to the main daemon that the script finished, do this once every 100ms instead of once every 1 second (This used to be ctdb commit 6a1f7a7b1b3a0b8f89998db8fdad83bbb4e9b5a5)
Diffstat (limited to 'ctdb/server/eventscript.c')
-rw-r--r--ctdb/server/eventscript.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index b4f5e2a10a..16cbaf86ce 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -183,8 +183,6 @@ int32_t ctdb_control_event_script_stop(struct ctdb_context *ctdb, TDB_DATA indat
struct ctdb_monitoring_status);
struct ctdb_monitor_script_status *script;
- DEBUG(DEBUG_INFO, ("event script stop called : %d\n", (int)res));
-
if (monitoring_status == NULL) {
DEBUG(DEBUG_ERR,(__location__ " script_status is NULL when script finished.\n"));
return -1;
@@ -199,6 +197,8 @@ int32_t ctdb_control_event_script_stop(struct ctdb_context *ctdb, TDB_DATA indat
script->finished = timeval_current();
script->status = res;
+ DEBUG(DEBUG_INFO, ("event script stop called for script:%s duration:%.1f status:%d\n", script->name, timeval_elapsed(&script->start), (int)res));
+
return 0;
}
@@ -796,7 +796,8 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
rt = ctdb_event_script_v(ctdb, state->options);
while ((ret = write(state->fd[1], &rt, sizeof(rt))) != sizeof(rt)) {
- sleep(1);
+ write(state->fd[1], &rt, sizeof(rt));
+ usleep(100000);
}
_exit(rt);
}