You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.0 KiB
C

#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdbool.h>
#include <unistd.h>
#include <signal.h>
#include <sys/prctl.h>
#include "model.h"
#include "model/server.h"
#include "process.h"
#include <curl/curl.h>
#include <stdlib.h>
bool terminate = false;
void handle_ctrl_c(int)
{
terminate = true;
}
int main( int argc, char* argv[] )
{
curl_global_init(CURL_GLOBAL_DEFAULT);
model_init();
signal(SIGINT, handle_ctrl_c);
signal(SIGPIPE, SIG_IGN);
if( !app_args_new( argc, argv ) ) {
return 1;
}
int code = 0;
if( g_server->section == -1 ) {
printf( "Starting Apogee ActivityPub server...\n" );
process_start_section(6);
sleep(3);
process_start_section(0);
process_start_section(1);
process_start_section(2);
process_start_section(5);
process_wait_for_finished();
printf( "Apogee server shutting down...\n" );
code = EXIT_SUCCESS;
} else {
printf( "section = %d\n", g_server->section );
process_run_section( g_server->section );
}
curl_global_cleanup();
app_args_release(g_server);
return code;
}