import the first version of cmslu
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@460 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
73
core/main.cpp
Executable file
73
core/main.cpp
Executable file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is a part of CMSLU -- Content Management System like Unix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <signal.h>
|
||||
#include <iostream>
|
||||
#include "requestcontroller.h"
|
||||
#include "data.h"
|
||||
#include "log.h"
|
||||
#include "request.h"
|
||||
#include "db.h"
|
||||
|
||||
|
||||
// singletons
|
||||
// first 'data' then 'log' then 'request'
|
||||
Data data;
|
||||
Log log;
|
||||
Request request;
|
||||
Db db;
|
||||
|
||||
|
||||
|
||||
|
||||
void signal_term(int)
|
||||
{
|
||||
log << log1 << "system aborted" << logend;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std::srand(std::time(0));
|
||||
|
||||
|
||||
log.Init(data.log_level, data.log_file, data.log_stdout);
|
||||
|
||||
|
||||
RequestController req_controller;
|
||||
|
||||
//data.read_from_file();
|
||||
|
||||
|
||||
db.Init(data.db_database, data.db_user, data.db_pass);
|
||||
|
||||
if( !req_controller.Init() )
|
||||
return 1;
|
||||
|
||||
log << log1 << "system started" << logend;
|
||||
|
||||
signal(SIGTERM, signal_term);
|
||||
|
||||
|
||||
log << log1 << "checking for table consistency...";
|
||||
db.CheckAllUrlSubject();
|
||||
log << log1 << "done" << logend;
|
||||
|
||||
|
||||
req_controller.Loop();
|
||||
|
||||
log << log1 << "system stopped" << logend;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user