X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain.cpp;h=c2c499fbbc205503ed42da278f585dfbc60c1ad1;hb=14fff12d9df0ee30e2df4bf9d22c2e83065816df;hp=17d6b6757f2c0721018713f9f69592d4a208dc11;hpb=f60495a029c54358f82956482fe203fe2b7b5b23;p=fms.git diff --git a/src/main.cpp b/src/main.cpp index 17d6b67..c2c499f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include #ifdef _WIN32 #include "../include/fmsservice.h" @@ -19,6 +21,8 @@ int main(int argc, char *argv[]) { + bool daemon=false; + #ifdef XMEM xmem_disable_print(); #endif @@ -30,6 +34,7 @@ int main(int argc, char *argv[]) if(argv[1] && strncmp(argv[1],"-d",2)==0) { Daemonize(); + daemon=true; } #else if(argv[1] && strncmp(argv[1],"-i",2)==0) @@ -91,15 +96,18 @@ int main(int argc, char *argv[]) signal(SIGBREAK,SigHandler); #endif - std::cout << "FMS Running in console mode." << std::endl; - std::cout << "Use the administration pages, or CTRL+C to exit" << std::endl << std::endl; - std::cout << "Available command line arguments:" << std::endl; -#ifdef _WIN32 - std::cout << "-i\tinstall service" << std::endl; - std::cout << "-u\tuninstall service" << std::endl; -#else - std::cout << "-d\trun as daemon" << std::endl; -#endif + if(daemon==false) + { + std::cout << "FMS Running in console mode." << std::endl; + std::cout << "Use the administration pages, or CTRL+C to exit" << std::endl << std::endl; + std::cout << "Available command line arguments:" << std::endl; + #ifdef _WIN32 + std::cout << "-i\tinstall service" << std::endl; + std::cout << "-u\tuninstall service" << std::endl; + #else + std::cout << "-d\trun as daemon" << std::endl; + #endif + } MainFunction(); @@ -126,5 +134,7 @@ void MainFunction() PThread::Sleep(1000); }while(!wantshutdown); + LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_DEBUG,"FMS wants to shutdown"); + Shutdown(); }