Exemplo n.º 1
0
static rstatus_t
nc_pre_run(struct instance *nci)
{
    rstatus_t status;

    status = log_init(nci->log_level, nci->log_filename);
    if (status != NC_OK) {
        return status;
    }

    if (daemonize) {
        status = nc_daemonize(1);
        if (status != NC_OK) {
            return status;
        }
    }

    nci->pid = getpid();

    status = signal_init();
    if (status != NC_OK) {
        return status;
    }

    if (nci->pid_filename) {
        status = nc_create_pidfile(nci);
        if (status != NC_OK) {
            return status;
        }
    }

    nc_print_run(nci);

    return NC_OK;
}
Exemplo n.º 2
0
static rstatus_t
nc_master_pre_run(struct env_master *env)
{
    rstatus_t status;

    status = log_init(env->log_level, env->log_filename);
    if (status != NC_OK) {
        return status;
    }
    // master run as daemon process. belong to INIT process
	daemonize = 0;  
    if (daemonize) {
        status = nc_daemonize(1);
        if (status != NC_OK) {
            return status;
        }
    }

	

    env->pid = getpid();
	
    // init the signalling handler
    status = signal_init();
    if (status != NC_OK) {
        return status;
    }

    if (env->pid_filename) {
        status = nc_create_pidfile(env);
        if (status != NC_OK) {
            return status;
        }
    }

    nc_print_run(env);

    return NC_OK;
}