/** * Restart a monitor * @param dcb Client DCB * @param tree Parse tree */ void exec_restart_monitor(DCB *dcb, MAXINFO_TREE *tree) { char errmsg[120]; if (tree && tree->value) { MONITOR* monitor = monitor_find(tree->value); if (monitor) { monitorStart(monitor, NULL); maxinfo_send_ok(dcb); } else { if (strlen(tree->value) > 80) // Prevent buffer overrun { tree->value[80] = 0; } sprintf(errmsg, "Invalid argument '%s'", tree->value); maxinfo_send_error(dcb, 0, errmsg); } } else { sprintf(errmsg, "Missing argument for 'RESTART MONITOR'"); maxinfo_send_error(dcb, 0, errmsg); } }
/** * Command to restart a stopped monitor * * @param dcb The DCB to use to print messages * @param monitor The monitor to restart */ static void restart_monitor(DCB *dcb, MONITOR *monitor) { monitorStart(monitor); }