예제 #1
0
int main(int argc, char** argv)
{
  const char* iniFile = DEFAULT_INI_FILE;
  if (argc > 1)
	iniFile = argv[1];

#if !defined(_WIN32) && !defined(_WIN64)
  ::signal(SIGTERM, sigHandler);
  ::signal(SIGHUP,  sigHandler);
#endif

  int ret = 0;

  do {
	  m_signal = 0;

	  CMMDVMHost* host = new CMMDVMHost(std::string(iniFile));
	  ret = host->run();

	  delete host;

	  if (m_signal == 15)
		  ::LogInfo("Caught SIGTERM, exiting");

	  if (m_signal == 1)
		  ::LogInfo("Caught SIGHUP, restarting");
  } while (m_signal == 1);

  ::LogFinalise();

  return ret;
}
예제 #2
0
int main(int argc, char** argv)
{
	const char* iniFile = DEFAULT_INI_FILE;
	if (argc > 1) {
		for (int currentArg = 1; currentArg < argc; ++currentArg) {
			std::string arg = argv[currentArg];
			if ((arg == "-v") || (arg == "--version")) {
				::fprintf(stdout, "MMDVMHost version %s\n", VERSION);
				return 0;
			} else if (arg.substr(0,1) == "-") {
				::fprintf(stderr, "Usage: MMDVMHost [-v|--version] [filename]\n");
				return 1;
			} else {
				iniFile = argv[currentArg];
			}
		}
	}

#if !defined(_WIN32) && !defined(_WIN64)
  ::signal(SIGTERM, sigHandler);
  ::signal(SIGHUP,  sigHandler);
#endif

  int ret = 0;

  do {
	  m_signal = 0;

	  CMMDVMHost* host = new CMMDVMHost(std::string(iniFile));
	  ret = host->run();

	  delete host;

	  if (m_signal == 15)
		  ::LogInfo("Caught SIGTERM, exiting");

	  if (m_signal == 1)
		  ::LogInfo("Caught SIGHUP, restarting");
  } while (m_signal == 1);

  ::LogFinalise();

  return ret;
}
예제 #3
0
int main(int argc, char** argv)
{
  if (argc == 1) {
    ::fprintf(stderr, "Usage: MMDVMHost <conf file>\n");
    return 1;
  }

#if !defined(_WIN32) && !defined(_WIN64)
  ::signal(SIGUSR1, sigHandler);
#endif

  CMMDVMHost* host = new CMMDVMHost(std::string(argv[1]));
  int ret2 = host->run();

  delete host;

  ::LogFinalise();

  return ret2;
}