// This file is called from ShowServerStatus.csp and provides functions
// to start, stop, restart, enable, and disable a server. It performs one
// of these actions on the server that was chosen in ChooseServer.csp.
<!-- #include file="RetrieveIStore.csp" -->
<!-- #include file=helper_js.csp -->
// Constants for the ManageServer method.
function StopServer(IStore, ServerId)
// Stops a server when given that server's ID. Be careful when using this
// function to stop the WCS or APS.
var ServerInfoObject = IStore.Query
("SELECT SI_NAME, SI_SERVER_IS_ALIVE, SI_DISABLED, SI_SERVER_KIND "
+ "FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerId).Item(1);
// Get the actual Server object.
var ServerObj = ServerInfoObject.PluginInterface("");
if ((ServerObj.ServerKind=='aps')||(ServerObj.ServerKind=='wcs'))
Response.Write("This example does not stop the APS server or WCS server.");
// Stop the server.To run on Unix, ManageServer requires values for the parameters
//TimeoutSeconds, UserName, and Password.
ServerObj.ManageServer(ceServerStop);
Response.Write("Unable to stop the server.")
function StartServer(IStore, ServerId)
// Starts a server when given that server's Id. To run on Unix, ManageServer requires values for the parameters
//TimeoutSeconds, UserName, and Password.
var ServerInfoObject = IStore.Query
("SELECT SI_NAME, SI_SERVER_IS_ALIVE, SI_DISABLED FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerId).Item(1);
// Get the actual Server object.
var ServerObj = ServerInfoObject.PluginInterface("");
ServerObj.ManageServer(ceServerStart);
Response.Write("Unable to start the server.")
function RestartServer(IStore, ServerId)
// Restart a server when given that server's ID. If you restart the
// WCS, you will lose your session.To run on Unix, ManageServer requires values for the parameters
//TimeoutSeconds, UserName, and Password.
var ServerInfoObject = IStore.Query("SELECT SI_NAME, SI_SERVER_IS_ALIVE, SI_DISABLED FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerId).Item(1);
// Get the actual Server object.
var ServerObj = ServerInfoObject.PluginInterface("");
ServerObj.ManageServer(ceServerReStart);
Response.Write("Unable to restart the server.")
function EnableServer(IStore, ServerId)
// Enables a server when given that server's ID.
var Servers = IStore.Query("SELECT SI_NAME, SI_SERVER_IS_ALIVE, SI_DISABLED FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerId);
var ServerInfoObject = Servers.Item(1);
// Get the actual Server object.
var ServerObj = ServerInfoObject.PluginInterface("");
// Set Disabled to false. This tells the APS that you want to enable the server.
// Save the changes to the APS. This will enable the server.
function DisableServer(IStore, ServerId)
// Disables a server when given that server's ID.
// If you disable all APSs and all WCSs, you will not be able
// to query the APS or run any scripts on the WCS.
var Servers = IStore.Query("SELECT SI_NAME, SI_SERVER_IS_ALIVE, SI_DISABLED FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerId);
var ServerInfoObject = Servers.Item(1);
// Get the actual server object.
var ServerObj = ServerInfoObject.PluginInterface("");
// Set Disabled to true to tell the APS to disable the server.
// Save the changes to the APS. This will disable the server.
Response.Redirect ("Start.csp");
ServerId = Request.QueryString.Item("ServerId");
// Check to see which button was pushed and perform the appropriate
if (Request.Form.Item("Stop") == "Stop") StopServer(IStore,ServerId);
if (Request.Form.Item("Start") == "Start") StartServer(IStore,ServerId);
if (Request.Form.Item("Disable") == "Disable") DisableServer(IStore, ServerId);
if (Request.Form.Item("Enable") == "Enable") EnableServer(IStore,ServerId);
if (Request.Form.Item("Restart") == "Restart") RestartServer(IStore,ServerId);
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |