Ejemplo n.º 1
0
gboolean
services_action_sync(svc_action_t * op)
{
    gboolean rc = TRUE;

    if (op == NULL) {
        crm_trace("No operation to execute");
        return FALSE;

    } else if (op->standard && strcasecmp(op->standard, "upstart") == 0) {
#if SUPPORT_UPSTART
        rc = upstart_job_exec(op, TRUE);
#endif
    } else if (op->standard && strcasecmp(op->standard, "systemd") == 0) {
#if SUPPORT_SYSTEMD
        rc = systemd_unit_exec(op, TRUE);
#endif
    } else {
        rc = services_os_action_execute(op, TRUE);
    }
    crm_trace(" > %s_%s_%d: %s = %d", op->rsc, op->action, op->interval, op->opaque->exec, op->rc);
    if (op->stdout_data) {
        crm_trace(" >  stdout: %s", op->stdout_data);
    }
    if (op->stderr_data) {
        crm_trace(" >  stderr: %s", op->stderr_data);
    }
    return rc;
}
Ejemplo n.º 2
0
gboolean
services_action_async(svc_action_t * op, void (*action_callback) (svc_action_t *))
{
    if (action_callback) {
        op->opaque->callback = action_callback;
    }

    if (op->interval > 0) {
        if (handle_duplicate_recurring(op, action_callback) == TRUE) {
            /* entry rescheduled, dup freed */
            return TRUE;
        }
        g_hash_table_replace(recurring_actions, op->id, op);
    }
    if (op->standard && strcasecmp(op->standard, "upstart") == 0) {
#if SUPPORT_UPSTART
        return upstart_job_exec(op, FALSE);
#endif
    }
    if (op->standard && strcasecmp(op->standard, "systemd") == 0) {
#if SUPPORT_SYSTEMD
        return systemd_unit_exec(op, FALSE);
#endif
    }
    return services_os_action_execute(op, FALSE);
}
Ejemplo n.º 3
0
gboolean
services_action_async(svc_action_t * op, void (*action_callback) (svc_action_t *))
{
    if (action_callback) {
        op->opaque->callback = action_callback;
    }

    if (recurring_actions == NULL) {
        recurring_actions = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
    }

    if (op->interval > 0) {
        g_hash_table_replace(recurring_actions, op->id, op);
    }
    if (op->standard && strcasecmp(op->standard, "upstart") == 0) {
#if SUPPORT_UPSTART
        return upstart_job_exec(op, FALSE);
#endif
    }
    if (op->standard && strcasecmp(op->standard, "systemd") == 0) {
#if SUPPORT_SYSTEMD
        return systemd_unit_exec(op, FALSE);
#endif
    }
    return services_os_action_execute(op, FALSE);
}
Ejemplo n.º 4
0
static gboolean
action_async_helper(svc_action_t * op) {
    gboolean res = FALSE;

    if (op->standard && strcasecmp(op->standard, "upstart") == 0) {
#if SUPPORT_UPSTART
        res = upstart_job_exec(op, FALSE);
#endif
    } else if (op->standard && strcasecmp(op->standard, "systemd") == 0) {
#if SUPPORT_SYSTEMD
        res =  systemd_unit_exec(op);
#endif
    } else {
        res = services_os_action_execute(op, FALSE);
    }

    /* keep track of ops that are in-flight to avoid collisions in the same namespace */
    if (res) {
        inflight_ops = g_list_append(inflight_ops, op);
    }

    return res;
}