1 #include "../include/global.h"
\r
2 #include "../include/commandthread.h"
\r
3 #include "../include/threadcontroller.h"
\r
10 #include "../include/freenet/fcpv2.h"
\r
13 #include "../include/fmsservice.h"
\r
15 #include "../include/fmsdaemon.h"
\r
22 int main(int argc, char *argv[])
\r
28 xmem_disable_print();
\r
35 if(argv[1] && strncmp(argv[1],"-d",2)==0)
\r
41 if(argv[1] && strncmp(argv[1],"-i",2)==0)
\r
43 if(ServiceIsInstalled())
\r
45 std::cout << "FMS Service is already installed" << std::endl;
\r
49 if(ServiceInstall())
\r
51 std::cout << "FMS Service Installed" << std::endl;
\r
55 std::cout << "Error installing FMS Service" << std::endl;
\r
60 else if(argv[1] && strncmp(argv[1],"-u",2)==0)
\r
62 if(ServiceIsInstalled())
\r
64 if(ServiceUninstall())
\r
66 std::cout << "FMS Service uninstalled" << std::endl;
\r
70 std::cout << "There was a problem uninstalling the service" << std::endl;
\r
75 std::cout << "FMS Service is not currently installed" << std::endl;
\r
79 else if(argv[1] && strncmp(argv[1],"-s",2)==0)
\r
86 std::cout << "FMS Service could not be started at this time" << std::endl;
\r
93 signal(SIGINT,SigHandler);
\r
94 signal(SIGTERM,SigHandler);
\r
95 signal(SIGABRT,SigHandler);
\r
97 signal(SIGBREAK,SigHandler);
\r
102 std::cout << "FMS Running in console mode." << std::endl;
\r
103 std::cout << "Use the administration pages, or CTRL+C to exit" << std::endl << std::endl;
\r
104 std::cout << "Available command line arguments:" << std::endl;
\r
106 std::cout << "-i\tinstall service" << std::endl;
\r
107 std::cout << "-u\tuninstall service" << std::endl;
\r
109 std::cout << "-d\trun as daemon" << std::endl;
\r
118 void MainFunction()
\r
123 SetupDefaultOptions();
\r
129 LogFile::Instance()->WriteLog(LogFile::LOGLEVEL_INFO,"FMS startup v"FMS_VERSION);
\r
131 ThreadController::Instance()->StartThreads();
\r
135 PThread::Sleep(1000);
\r
136 }while(!wantshutdown);
\r