/*
* Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ * Author : Maksym Mamontov <stg@madf.info>
*/
/*
#include "listener.h"
#include "pidfile.h"
-using namespace std;
-
#ifdef DEBUG
# define MAIN_DEBUG 1
# define NO_DAEMON 1
#define START_FILE "/._ST_ART_ED_"
-set<pid_t> executersPid;
+std::set<pid_t> executersPid;
volatile time_t stgTime = time(NULL);
//-----------------------------------------------------------------------------
void KillExecuters()
{
-set<pid_t>::iterator pid;
+std::set<pid_t>::iterator pid;
pid = executersPid.begin();
while (pid != executersPid.end())
{
}
}
//-----------------------------------------------------------------------------
+#if defined(LINUX) || defined(DARWIN)
int StartScriptExecuter(char * procName, int msgKey, int * msgID)
+#else
+int StartScriptExecuter(char *, int msgKey, int * msgID)
+#endif
{
STG_LOGGER & WriteServLog = GetStgLogger();
//close(1);
//close(2);
//setsid();
+#if defined(LINUX) || defined(DARWIN)
Executer(*msgID, executerPid, procName);
+#else
+ Executer(*msgID, executerPid);
+#endif
return 1;
default: // Parent
if (executersPid.empty())
+#if defined(LINUX) || defined(DARWIN)
Executer(*msgID, executerPid, NULL);
+#else
+ Executer(*msgID, executerPid);
+#endif
executersPid.insert(executerPid);
}
return 0;
}
//-----------------------------------------------------------------------------
#ifdef NO_DAEMON
-int ForkAndWait(const string &)
+int ForkAndWait(const std::string &)
#else
-int ForkAndWait(const string & confDir)
+int ForkAndWait(const std::string & confDir)
#endif
{
#ifndef NO_DAEMON
int execNum = 0;
int execMsgKey = 0;
-string logFileName;
-string confDir;
-string password;
-string onConnect;
-string onDisconnect;
+std::string logFileName;
+std::string confDir;
+std::string password;
+std::string onConnect;
+std::string onDisconnect;
int port;
int userTimeout;