Source
if (NULL == (service = CreateService(mgr, wservice_name, wservice_name, GENERIC_READ, SERVICE_WIN32_OWN_PROCESS,
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program 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 2 of the License, or
** (at your option) any later version.
**
** This program 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 this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
static SERVICE_STATUS serviceStatus;
static SERVICE_STATUS_HANDLE serviceHandle;
/* required for closing application from service */
static int application_status = ZBX_APP_RUNNING;
static zbx_on_exit_t zbx_on_exit_cb;
int ZBX_IS_RUNNING(void)
{
return application_status;
}
void ZBX_DO_EXIT(void)
{
application_status = ZBX_APP_STOPPED;
}
/* free resources allocated by MAIN_ZABBIX_ENTRY() */
void zbx_free_service_resources(int ret);
static void parent_signal_handler(int sig)
{
switch (sig)
{
case SIGINT:
case SIGTERM:
ZBX_DO_EXIT();
zabbix_log(LOG_LEVEL_INFORMATION, "Got signal. Exiting ...");
zbx_on_exit_cb(SUCCEED);
break;