/*
*
* ProLinga-Run
*
* Copyright (C) 2002-2008 Xobas Software.
* All rights reserved.
*
* This file is part of ProLinga-Run.
*
* ProLinga-Run is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProLinga-Run is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProLinga-Run. If not, see .
*
* More information is available at the following addresses:
*
* Website : http://www.prolinga.org
*
* Email : prolinga-list@prolinga.org
*
*
*/
#include "RunCommon.h"
#include
#include
#include
#include
#include
#include "RunConfig.hpp"
#include "BuiltIn.hpp"
#include "DataRef.hpp"
#include "CmdList.hpp"
#include "LogicCommandDef.hpp"
#include "RunShare.hpp"
#include
/* Global Pointers */
PlRunPtr runPtr;
pthread_t mainThreadId = pthread_self();
void ResetRunService(int signo)
{
/* Close Run */
runPtr->runClose();
/* Open Run */
runPtr->runOpen(NULL, -1, NULL);
}
void StopRunService(int signo)
{
/* Close Data */
runPtr->runClose();
/* Exit */
exit(0);
}
int main(int argc, char **argv)
{
pid_t pid;
char *serverHost, *logFile;
int serverPort, numThreads = 0, compLevel = 0, logLevel = 0, i;
PlSoapService sservice;
ConfigRunPtr confRunPtr;
/* Set global pointer for signal handlers */
runPtr = new PlRun;
/* Process command line arguments */
if (argc > 1)
{
for (i = 1; igetStringValue("LogFile", DEF_LOG_FILE);
confRunPtr->writeConfig(logFile);
/* Fork Process */
pid = fork();
if (pid < 0)
{
printf("Error creating server process\n");
exit(-1);
}
else if (pid != 0)
{
/* Parent Process */
exit(0);
}
else
{
/* Child Process */
setsid();
umask(0);
chdir("/");
/* Get Service parameters */
serverHost = confRunPtr->getStringValue("ServerHost", DEF_SERVER_HOST);
serverPort = confRunPtr->getNumberValue("ServerPort", DEF_SERVER_PORT);
numThreads = confRunPtr->getNumberValue("NumberOfThreads", DEF_NUMBER_THREADS);
compLevel = confRunPtr->getNumberValue("ServerCompressionLevel", DEF_SERVER_COMP_LEVEL);
logLevel = confRunPtr->getNumberValue("LogLevel", DEF_LOG_LEVEL);
/* Open Run */
runPtr->runOpen(NULL, argc, argv);
/*Start the Repository Service */
sservice.soapServiceStart(serverHost, serverPort, numThreads, compLevel, logFile, logLevel);
/* Close Run */
runPtr->runClose();
/* Clean up */
delete confRunPtr;
/* Return */
return 0;
}
}