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
24 xmem_disable_print();
\r
31 if(argv[1] && strncmp(argv[1],"-d",2)==0)
\r
37 if(argv[1] && strncmp(argv[1],"-i",2)==0)
\r
39 if(ServiceIsInstalled())
\r
41 std::cout << "FMS Service is already installed" << std::endl;
\r
45 if(ServiceInstall())
\r
47 std::cout << "FMS Service Installed" << std::endl;
\r
51 std::cout << "Error installing FMS Service" << std::endl;
\r
56 else if(argv[1] && strncmp(argv[1],"-u",2)==0)
\r
58 if(ServiceIsInstalled())
\r
60 if(ServiceUninstall())
\r
62 std::cout << "FMS Service uninstalled" << std::endl;
\r
66 std::cout << "There was a problem uninstalling the service" << std::endl;
\r
71 std::cout << "FMS Service is not currently installed" << std::endl;
\r
75 else if(argv[1] && strncmp(argv[1],"-s",2)==0)
\r
82 std::cout << "FMS Service could not be started at this time" << std::endl;
\r
89 signal(SIGINT,SigHandler);
\r
90 signal(SIGTERM,SigHandler);
\r
91 signal(SIGABRT,SigHandler);
\r
93 signal(SIGBREAK,SigHandler);
\r
98 std::cout << "FMS Running in console mode." << std::endl;
\r
99 std::cout << "Use the administration pages, or CTRL+C to exit" << std::endl << std::endl;
\r
100 std::cout << "Available command line arguments:" << std::endl;
\r
102 std::cout << "-i\tinstall service" << std::endl;
\r
103 std::cout << "-u\tuninstall service" << std::endl;
\r
105 std::cout << "-d\trun as daemon" << std::endl;
\r
114 void MainFunction()
\r
119 SetupDefaultOptions();
\r
125 LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_INFO,"FMS startup v"FMS_VERSION);
\r
127 ThreadController::Instance()->StartThreads();
\r
131 PThread::Sleep(1000);
\r
132 }while(!wantshutdown);
\r