mirror of https://github.com/Icinga/icinga2.git
parent
03750951c2
commit
7805b23330
|
@ -44,6 +44,11 @@ namespace po = boost::program_options;
|
||||||
|
|
||||||
static po::variables_map g_AppParams;
|
static po::variables_map g_AppParams;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
SERVICE_STATUS l_SvcStatus;
|
||||||
|
SERVICE_STATUS_HANDLE l_SvcStatusHandle;
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
static String LoadAppType(const String& typeSpec)
|
static String LoadAppType(const String& typeSpec)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
@ -409,6 +414,7 @@ int Main(void)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
static int SetupService(bool install, int argc, char **argv)
|
static int SetupService(bool install, int argc, char **argv)
|
||||||
{
|
{
|
||||||
SC_HANDLE schSCManager;
|
SC_HANDLE schSCManager;
|
||||||
|
@ -420,12 +426,10 @@ static int SetupService(bool install, int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a handle to the SCM database.
|
|
||||||
|
|
||||||
schSCManager = OpenSCManager(
|
schSCManager = OpenSCManager(
|
||||||
NULL, // local computer
|
NULL,
|
||||||
NULL, // ServicesActive database
|
NULL,
|
||||||
SC_MANAGER_ALL_ACCESS); // full access rights
|
SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if (NULL == schSCManager) {
|
if (NULL == schSCManager) {
|
||||||
printf("OpenSCManager failed (%d)\n", GetLastError());
|
printf("OpenSCManager failed (%d)\n", GetLastError());
|
||||||
|
@ -458,19 +462,19 @@ static int SetupService(bool install, int argc, char **argv)
|
||||||
|
|
||||||
if (install) {
|
if (install) {
|
||||||
schService = CreateService(
|
schService = CreateService(
|
||||||
schSCManager, // SCM database
|
schSCManager,
|
||||||
"icinga2", // name of service
|
"icinga2",
|
||||||
"Icinga 2", // service name to display
|
"Icinga 2",
|
||||||
SERVICE_ALL_ACCESS, // desired access
|
SERVICE_ALL_ACCESS,
|
||||||
SERVICE_WIN32_OWN_PROCESS, // service type
|
SERVICE_WIN32_OWN_PROCESS,
|
||||||
SERVICE_DEMAND_START, // start type
|
SERVICE_DEMAND_START,
|
||||||
SERVICE_ERROR_NORMAL, // error control type
|
SERVICE_ERROR_NORMAL,
|
||||||
szPath, // path to service's binary
|
szPath,
|
||||||
NULL, // no load ordering group
|
NULL,
|
||||||
NULL, // no tag identifier
|
NULL,
|
||||||
NULL, // no dependencies
|
NULL,
|
||||||
NULL, // LocalSystem account
|
NULL,
|
||||||
NULL); // no password
|
NULL);
|
||||||
|
|
||||||
if (schService == NULL) {
|
if (schService == NULL) {
|
||||||
printf("CreateService failed (%d)\n", GetLastError());
|
printf("CreateService failed (%d)\n", GetLastError());
|
||||||
|
@ -490,10 +494,6 @@ static int SetupService(bool install, int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
SERVICE_STATUS l_SvcStatus;
|
|
||||||
SERVICE_STATUS_HANDLE l_SvcStatusHandle;
|
|
||||||
|
|
||||||
VOID ReportSvcStatus(DWORD dwCurrentState,
|
VOID ReportSvcStatus(DWORD dwCurrentState,
|
||||||
DWORD dwWin32ExitCode,
|
DWORD dwWin32ExitCode,
|
||||||
DWORD dwWaitHint)
|
DWORD dwWaitHint)
|
||||||
|
|
Loading…
Reference in New Issue