X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffmsapp.cpp;h=261ea4643c96abe934b2bc8d34e670acb612c155;hb=e662ea47fba8715474851ceebacba400984ee433;hp=94443c4cd8440e298bda8018b8b986b4bbea85d4;hpb=026dc6b2bc548c945359c4e166eff514f2c47c6a;p=fms.git diff --git a/src/fmsapp.cpp b/src/fmsapp.cpp index 94443c4..261ea46 100644 --- a/src/fmsapp.cpp +++ b/src/fmsapp.cpp @@ -17,6 +17,8 @@ #include #include #include +#include +#include #ifdef _WIN32 #include @@ -99,7 +101,8 @@ void FMSApp::initialize(Poco::Util::Application &self) ServerApplication::initialize(self); // set working directory - fall back on application.dir if working directory isn't set - if(m_workingdirectory=="") + // if we are runing as a service, then working directory needs to be set to the application directory + if(m_workingdirectory=="" || config().getBool("application.runAsService",false)==true) { m_workingdirectory=config().getString("application.dir"); } @@ -159,7 +162,12 @@ int FMSApp::main(const std::vector &args) // so we need to set the working directory again int rval=chdir(m_workingdirectory.c_str()); - if(m_displayhelp) + if(VerifyDB()==false) + { + std::cout << "The FMS database failed verification. It is most likely corrupt!" << std::endl; + logger().fatal("The FMS database failed verification. It is most likely corrupt!"); + } + else if(m_displayhelp) { } else if(m_showoptions) @@ -173,6 +181,15 @@ int FMSApp::main(const std::vector &args) else { logger().information("FMS startup v"FMS_VERSION); + logger().information("Using SQLite "SQLITE_VERSION); + + std::string tempval=""; + Option::Instance()->Get("VacuumOnStartup",tempval); + if(tempval=="true") + { + logger().information("VACUUMing database"); + SQLite3DB::DB::Instance()->Execute("VACUUM;"); + } StartThreads(); @@ -246,6 +263,10 @@ void FMSApp::StartThreads() { logger().trace("FMSApp::StartThreads starting HTTPThread"); m_threads.Start(new HTTPThread()); + if(isInteractive()) + { + std::cout << "Started HTTP Thread" << std::endl; + } } else { @@ -258,6 +279,10 @@ void FMSApp::StartThreads() { logger().trace("FMSApp::StartThreads starting NNTPListener"); m_threads.Start(new NNTPListener()); + if(isInteractive()) + { + std::cout << "Started NNTP Thread" << std::endl; + } } else { @@ -270,6 +295,10 @@ void FMSApp::StartThreads() { logger().trace("FMSApp::StartThreads starting FreenetMasterThread"); m_threads.Start(new FreenetMasterThread()); + if(isInteractive()) + { + std::cout << "Started Freenet FCP Thread" << std::endl; + } } else {