Esempio n. 1
0
static gboolean
check_heartbeat (void *data)
{
    time_t now = time(NULL);
    int i;

    for (i = 0; i < N_HEARTBEAT; i++) {
        if (ctl->last_hb[i] == 0)
            ctl->last_hb[i] = now;
    }

    if (now - ctl->last_hb[HB_SEAFILE_SERVER] > MAX_HEARTBEAT_LIMIT) {

        try_kill_process(PID_SERVER);
        seaf_message ("seaf-server need restart...\n");
        start_seaf_server ();
        ctl->last_hb[HB_SEAFILE_SERVER] = time(NULL);

    }

    if (now - ctl->last_hb[HB_SEAFILE_MONITOR] > MAX_HEARTBEAT_LIMIT) {

        try_kill_process(PID_MONITOR);
        seaf_message ("seaf-mon need restart...\n");
        start_seaf_monitor ();
        ctl->last_hb[HB_SEAFILE_MONITOR] = time(NULL);
    }

    return TRUE;
}
Esempio n. 2
0
/* This would also stop seaf-server & other components */
static void
stop_ccnet_server ()
{
    seaf_message ("shutting down ccnet-server ...\n");
    GError *error = NULL;
    ccnet_client_send_cmd (ctl->sync_client, "shutdown", &error);

    try_kill_process(PID_CCNET);
    try_kill_process(PID_SERVER);
    try_kill_process(PID_SEAFDAV);
}