Example #1
0
/**
 * Stop a service
 * @param dcb Client DCB
 * @param tree Parse tree
 */
void exec_shutdown_service(DCB *dcb, MAXINFO_TREE *tree)
{
    char errmsg[120];
    if (tree && tree->value)
    {
        SERVICE* service = service_find(tree->value);
        if (service)
        {
            serviceStop(service);
            maxinfo_send_ok(dcb);
        }
        else
        {
            if (strlen(tree->value) > 80) // Prevent buffer overrun
            {
                tree->value[80] = 0;
            }
            sprintf(errmsg, "Invalid argument '%s'", tree->value);
            maxinfo_send_error(dcb, 0, errmsg);
        }
    }
    else
    {
        sprintf(errmsg, "Missing argument for 'SHUTDOWN SERVICE'");
        maxinfo_send_error(dcb, 0, errmsg);
    }
}
Example #2
0
BOOL WINAPI ControlHandler(DWORD dwCtrlType)
{
    switch (dwCtrlType)
    {
    case CTRL_BREAK_EVENT:
    case CTRL_C_EVENT:
        _tprintf(_T("Stopping %s."), SERVICE_DISPLAYNAME);
        serviceStop();
        return TRUE;
        break;
    }
    return FALSE;
}
Example #3
0
void WINAPI service_ctrl(DWORD ctrlCode) {
    switch (ctrlCode)
    {
    case SERVICE_CONTROL_STOP:
        reportStatusToSCM(SERVICE_STOP_PENDING, NO_ERROR, 0);
        serviceStop();
        break;

    case SERVICE_CONTROL_INTERROGATE:
        break;

    default:
        break;
    }
    reportStatusToSCM(s_status.dwCurrentState, NO_ERROR, 0);
}
Example #4
0
void MainWindow::serviceStopit()
{
 QTimer::singleShot(1000,this,SLOT(serviceStop()));
}
Example #5
0
/**
 * Debug command to stop a service
 *
 * @param dcb		The DCB to print any output to
 * @param service	The service to shutdown
 */
static void
shutdown_service(DCB *dcb, SERVICE *service)
{
	serviceStop(service);
}