1 #include "../include/global.h"
\r
2 #include "../include/commandthread.h"
\r
3 #include "../include/threadcontroller.h"
\r
10 #include "../include/fmsservice.h"
\r
12 #include "../include/fmsdaemon.h"
\r
19 int main(int argc, char *argv[])
\r
23 xmem_disable_print();
\r
30 if(argv[1] && strncmp(argv[1],"-d",2)==0)
\r
35 if(argv[1] && strncmp(argv[1],"-i",2)==0)
\r
37 if(ServiceIsInstalled())
\r
39 std::cout << "FMS Service is already installed" << std::endl;
\r
43 if(ServiceInstall())
\r
45 std::cout << "FMS Service Installed" << std::endl;
\r
49 std::cout << "Error installing FMS Service" << std::endl;
\r
54 else if(argv[1] && strncmp(argv[1],"-u",2)==0)
\r
56 if(ServiceIsInstalled())
\r
58 if(ServiceUninstall())
\r
60 std::cout << "FMS Service uninstalled" << std::endl;
\r
64 std::cout << "There was a problem uninstalling the service" << std::endl;
\r
69 std::cout << "FMS Service is not currently installed" << std::endl;
\r
73 else if(argv[1] && strncmp(argv[1],"-s",2)==0)
\r
80 std::cout << "FMS Service could not be started at this time" << std::endl;
\r
87 signal(SIGINT,SigHandler);
\r
88 signal(SIGTERM,SigHandler);
\r
89 signal(SIGABRT,SigHandler);
\r
91 signal(SIGBREAK,SigHandler);
\r
94 std::cout << "FMS Running in console mode." << std::endl;
\r
95 std::cout << "Use the administration pages, or CTRL+C to exit" << std::endl << std::endl;
\r
96 std::cout << "Available command line arguments:" << std::endl;
\r
98 std::cout << "-i\tinstall service" << std::endl;
\r
99 std::cout << "-u\tuninstall service" << std::endl;
\r
101 std::cout << "-d\trun as daemon" << std::endl;
\r
109 void MainFunction()
\r
114 SetupDefaultOptions();
\r
120 LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_INFO,"FMS startup v"FMS_VERSION);
\r
122 ThreadController::Instance()->StartThreads();
\r
126 PThread::Sleep(1000);
\r
127 }while(!wantshutdown);
\r