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
25 xmem_disable_print();
\r
32 if(argv[1] && strncmp(argv[1],"-d",2)==0)
\r
38 if(argv[1] && strncmp(argv[1],"-i",2)==0)
\r
40 if(ServiceIsInstalled())
\r
42 std::cout << "FMS Service is already installed" << std::endl;
\r
46 if(ServiceInstall())
\r
48 std::cout << "FMS Service Installed" << std::endl;
\r
52 std::cout << "Error installing FMS Service" << std::endl;
\r
57 else if(argv[1] && strncmp(argv[1],"-u",2)==0)
\r
59 if(ServiceIsInstalled())
\r
61 if(ServiceUninstall())
\r
63 std::cout << "FMS Service uninstalled" << std::endl;
\r
67 std::cout << "There was a problem uninstalling the service" << std::endl;
\r
72 std::cout << "FMS Service is not currently installed" << std::endl;
\r
76 else if(argv[1] && strncmp(argv[1],"-s",2)==0)
\r
83 std::cout << "FMS Service could not be started at this time" << std::endl;
\r
90 signal(SIGINT,SigHandler);
\r
91 signal(SIGTERM,SigHandler);
\r
92 signal(SIGABRT,SigHandler);
\r
94 signal(SIGBREAK,SigHandler);
\r
99 std::cout << "FMS Running in console mode." << std::endl;
\r
100 std::cout << "Use the administration pages, or CTRL+C to exit" << std::endl << std::endl;
\r
101 std::cout << "Available command line arguments:" << std::endl;
\r
103 std::cout << "-i\tinstall service" << std::endl;
\r
104 std::cout << "-u\tuninstall service" << std::endl;
\r
106 std::cout << "-d\trun as daemon" << std::endl;
\r
115 void MainFunction()
\r
120 SetupDefaultOptions();
\r
126 LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_INFO,"FMS startup v"FMS_VERSION);
\r
128 ThreadController::Instance()->StartThreads();
\r
132 PThread::Sleep(1000);
\r
133 }while(!wantshutdown);
\r