/****************************************************************************** mysql_stop() Stop the mysql servers. ******************************************************************************/ void mysql_stop() { log_info("Stopping the MySQL server(s)..."); stop_master(); stop_slave(); // activate the test screen ActivateScreen(getscreenhandle()); }
/****************************************************************************** mysql_start() Start the mysql servers. ******************************************************************************/ void mysql_start() { log_info("Starting the MySQL server(s): %u", ++restarts); start_master(); start_slave(); // activate the test screen ActivateScreen(getscreenhandle()); }
static void display_settings() { int status_array[SERVER_NUM_STATUS]; int i, status, total=0; int reqs = request_count; #ifdef DBINFO_ON int wblock = would_block; would_block = 0; #endif request_count = 0; ClearScreen (getscreenhandle()); printf("%s \n", ap_get_server_description()); for (i=0;i<SERVER_NUM_STATUS;i++) { status_array[i] = 0; } for (i = 0; i < ap_threads_limit; ++i) { status = (ap_scoreboard_image->servers[0][i]).status; status_array[status]++; } for (i=0;i<SERVER_NUM_STATUS;i++) { switch(i) { case SERVER_DEAD: printf ("Available:\t%d\n", status_array[i]); break; case SERVER_STARTING: printf ("Starting:\t%d\n", status_array[i]); break; case SERVER_READY: printf ("Ready:\t\t%d\n", status_array[i]); break; case SERVER_BUSY_READ: printf ("Busy:\t\t%d\n", status_array[i]); break; case SERVER_BUSY_WRITE: printf ("Busy Write:\t%d\n", status_array[i]); break; case SERVER_BUSY_KEEPALIVE: printf ("Busy Keepalive:\t%d\n", status_array[i]); break; case SERVER_BUSY_LOG: printf ("Busy Log:\t%d\n", status_array[i]); break; case SERVER_BUSY_DNS: printf ("Busy DNS:\t%d\n", status_array[i]); break; case SERVER_CLOSING: printf ("Closing:\t%d\n", status_array[i]); break; case SERVER_GRACEFUL: printf ("Restart:\t%d\n", status_array[i]); break; case SERVER_IDLE_KILL: printf ("Idle Kill:\t%d\n", status_array[i]); break; default: printf ("Unknown Status:\t%d\n", status_array[i]); break; } if (i != SERVER_DEAD) total+=status_array[i]; } printf ("Total Running:\t%d\tout of: \t%d\n", total, ap_threads_limit); printf ("Requests per interval:\t%d\n", reqs); #ifdef DBINFO_ON printf ("Would blocks:\t%d\n", wblock); printf ("Successful retries:\t%d\n", retry_success); printf ("Failed retries:\t%d\n", retry_fail); printf ("Avg retries:\t%d\n", retry_success == 0 ? 0 : avg_retries / retry_success); #endif }
static int CommandLineInterpreter(scr_t screenID, const char *commandLine) { char *szCommand = "APACHE2 "; int iCommandLen = 8; char szcommandLine[256]; char *pID; screenID = screenID; if (commandLine == NULL) return NOTMYCOMMAND; if (strlen(commandLine) <= strlen(szCommand)) return NOTMYCOMMAND; apr_cpystrn(szcommandLine, commandLine, sizeof(szcommandLine)); /* All added commands begin with "APACHE2 " */ if (!strnicmp(szCommand, szcommandLine, iCommandLen)) { ActivateScreen (getscreenhandle()); /* If an instance id was not given but the nlm is loaded in protected space, then the the command belongs to the OS address space instance to pass it on. */ pID = strstr (szcommandLine, "-p"); if ((pID == NULL) && nlmisloadedprotected()) return NOTMYCOMMAND; /* If we got an instance id but it doesn't match this instance of the nlm, pass it on. */ if (pID) { pID = &pID[2]; while (*pID && (*pID == ' ')) pID++; } if (pID && ap_my_addrspace && strnicmp(pID, ap_my_addrspace, strlen(ap_my_addrspace))) return NOTMYCOMMAND; /* If we have determined that this command belongs to this instance of the nlm, then handle it. */ if (!strnicmp("RESTART",&szcommandLine[iCommandLen],3)) { printf("Restart Requested...\n"); restart(); } else if (!strnicmp("VERSION",&szcommandLine[iCommandLen],3)) { printf("Server version: %s\n", ap_get_server_description()); printf("Server built: %s\n", ap_get_server_built()); } else if (!strnicmp("MODULES",&szcommandLine[iCommandLen],3)) { ap_show_modules(); } else if (!strnicmp("DIRECTIVES",&szcommandLine[iCommandLen],3)) { ap_show_directives(); } else if (!strnicmp("SHUTDOWN",&szcommandLine[iCommandLen],3)) { printf("Shutdown Requested...\n"); shutdown_pending = 1; } else if (!strnicmp("SETTINGS",&szcommandLine[iCommandLen],3)) { if (show_settings) { show_settings = 0; ClearScreen (getscreenhandle()); show_server_data(); } else { show_settings = 1; display_settings(); } } else { show_settings = 0; if (strnicmp("HELP",&szcommandLine[iCommandLen],3)) printf("Unknown APACHE2 command %s\n", &szcommandLine[iCommandLen]); printf("Usage: APACHE2 [command] [-p <instance ID>]\n"); printf("Commands:\n"); printf("\tDIRECTIVES - Show directives\n"); printf("\tHELP - Display this help information\n"); printf("\tMODULES - Show a list of the loaded modules\n"); printf("\tRESTART - Reread the configuration file and restart Apache\n"); printf("\tSETTINGS - Show current thread status\n"); printf("\tSHUTDOWN - Shutdown Apache\n"); printf("\tVERSION - Display the server version information\n"); } /* Tell NetWare we handled the command */ return HANDLEDCOMMAND; } /* Tell NetWare that the command isn't mine */ return NOTMYCOMMAND; }