RE: onstat
Posted in 2001
I got this email awhile back:
>PEOple,
>
>For those of you who do not know, it is very tough to determine the *real*
>status of IDS. "onstat -" will return, stating that the server is "online"
>but many times it is in the process of a "fast recovery", etc. In
>addition, "onstat -" previously would simply return (via a return code) a
>success or fail. Although success would be returned, this did *not* mean
>that the server was truly available.
>
>This makes scripting difficult using the "onstat -" command (when you must
>ensure that IDS is up *and* available prior to executing other "on*"
>utilities). There is an undocumented feature in which meaningful return
>codes are returned from "onstat -". I am not sure when this undocumented
>feature was added but I do know that it was added at SAP's request.
>
>If I only would have known, this would have made my life a lot easier in
>many situations. Hopefully, this will help you TA's when you encounter
>such a problem.
>
>(See below.) Please let me know if you have any questions.
>
>Ciao,
>Frank
>
>>>>To find out the server state, we check the return code of onstat -. This
>>>>feature
>>>>is available since 6.00.ud1. From the typedef shown below, you can map
>>>>the
>>>>return codes to the actual server state.
>>>>
>>>>typedef enum {
>>>> RDW_SERVER_OFFLINE = 255,
>>>> RDW_SERVER_INITIALIZING = 0,
>>>> RDW_SERVER_QUIESCENT = 1,
>>>> RDW_SERVER_RECOVERING = 2,
>>>> RDW_SERVER_ARCHIVING = 3,
>>>> RDW_SERVER_SHUTTING = 4,
>>>> RDW_SERVER_ONLINE = 5,
>>>> RDW_SERVER_ABORTING = 6 } rdw_servermode;
>>>>
>>>>
>>>>The NT c program would look like this:
>>>>
>>>> char cmd[128];
>>>> char *informixdir;
>>>>
>>>> DWORD exitCode=0;
>>>> STARTUPINFO startupInfo;
>>>> PROCESS_INFORMATION processInfo;
>>>>
>>>> ZeroMemory(&startupInfo, sizeof(startupInfo));
>>>> startupInfo.cb =sizeof(startupInfo);
>>>> startupInfo.wShowWindow =SW_HIDE;
>>>> startupInfo.dwFlags =STARTF_USESHOWWINDOW;
>>>>
>>>> informixdir=getenv("INFORMIXDIR");
>>>> if (informixdir == NULL) {};
>>>>
>>>> strcpy(cmd, informixdir);
>>>> strcat(cmd, "\\\\bin\\\\onstat.exe");
>>>>
>>>> if (CreateProcess(cmd, " - ",
>>>> NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
>>>> &startupInfo,&processInfo)) {
>>>> CloseHandle(processInfo.hThread);
>>>>
>>>> if (WaitForSingleObject(processInfo.hProcess, INFINITE) !=
>>>>WAIT_FAILED) {
>>>> GetExitCodeProcess(processInfo.hProcess, &exitCode);
>>>> }
>>>> CloseHandle(processInfo.hProcess);
>>>> }
>>>> if (exitCode == 0) {
>>>> return (RDW_RDWERR);
>>>> }
>>>> else return((int)exitCode);
>>>>
>>>>
>>>>
>>>>
>
>
>
>From: Bogdan Neagu <bogdan.neagu@alcatel.com>
>To: informix-list@iiug.org
>Subject: onstat
>Date: Mon, 29 Jan 2001 11:17:27 -0500
>Reply-To: Bogdan Neagu <bogdan.neagu@alcatel.com>
>
>Hi all.
>
>I was told by our DBA that onstat has different exit codes depending on
>the engine's mode (or mood).
>
>So, if I test $result (in C shell) or $? (Bourne / Korn shell), I should
>get a numeric value.
>
>My tests show 1=Quiescent, 5=On-Line.
>
>Does anyone know what these values are ? And yes, I tried to RTFM.
>
>Thanks in advance,
>
>Bogdan Neagu
------------------------------------------------------------
--== Sent via Deja.com ==--
http://www.deja.com/