Shutdown
Terminates CitectSCADA's operation. Use this function to shut down the CitectSCADA system, otherwise buffered data could be lost.
Note: With one exception, the Shutdown command will succeed only if there is an Alarm Server in your system. The exception to this is if you specify an empty string for the sDest parameter (shutdown this computer only). In this case the shutdown will succeed even if there is no Alarm Server.
The shutdown can affect only the computer that calls it, or all or part of a CitectSCADA network. If you are shutting down a network, specify the computers (Control Clients and servers) to be shut down in sDest, and the extent of the shutdown in Mode.
Note: If [Shutdown]NetworkIgnore
parameter is set to 0
(zero) and a client receives a shutdown request message from a
server. Phase 2 clients only receive a shutdown request when the
first phase 1 client has reconnected to the server.
You can allow selected computers to override the shutdown with the [Shutdown]NetworkIgnore parameter. (You might set this parameter for key servers, for example, I/O servers.)
Use the ShutdownForm() function to prompt the user for verification before shutting CitectSCADA down.
Note: If the [Shutdown]NetworkStart
parameter is set to 0
(zero), the Shutdown() function will ignore the sDest argument. This will result in the shutting
down and restarting of the machine the function is run on
regardless of the machine specified.
Syntax
Shutdown( [sDest] [, sProject] [, Mode] [, ClusterName] [, CallEvent])
sDest:
The destination computer(s) to be shut down, as a string:
"" (blank string) - This computer only - Default value
["Computer_Name"] - The specified CitectSCADA client (defined in the computer's CITECT.INI file)
["Server_Name"] - The specified CitectSCADA server
"All Clients" - All CitectSCADA clients on the network
"All Servers" - All CitectSCADA servers on the network
"Everybody" - All CitectSCADA computers on the network
sProject:
The full path of the project to run on restart as a string. The path is written to the configuration files and is used when the system restarts. The default value is "", which means that no changes are made to the configuration and the current project is restarted.
Mode:
The type of shutdown:
1 - Shutdown CitectSCADA only - Default value
2 - Shutdown and restart CitectSCADA (without logging off Windows)
3 - Shutdown and restart CitectSCADA and log off Windows (needs to set up an auto login to the Operating System and CitectSCADA needs to be configured to run on start up or log in)
4 - Shutdown CitectSCADA and re-boot the computer
5 - Shutdown CitectSCADA only
6 - Shutdown and restart CitectSCADA clients, but not this computer
7 - Shutdown CitectSCADA and shutdown the computer. If the computer supports power off feature the power will be turned off
ClusterName:
The name of the cluster that the machine(s) named in Dest belongs to. This is not required if:
CallEvent:
Flag for initiating a user-specified shutdown event prior to shutting down. Refer to OnEvent() type code for the value of shutdown event.
Note: If the event handler is non-interactive with an instant return value, it can be called directly.
Note: If the event handler is interactive or with a long delay in processing the event, it needs to be called indirectly using the NewTask("EventHandler") function, and the actual handler, EventHandler(), needs to call Shutdown() with the CallEvent flag set to 0 from the handler if it decides the shutdown is permitted.
Return Value
0 (zero) if successful, otherwise an error is returned.
Related Functions
ProjectRestartGet, ProjectRestartSet, ProjectSet, ShutdownMode, ShutdownForm, OnEvent
Example
/* Shut down CitectSCADA on this computer. */
Shutdown();
/* Shut down and restart CitectSCADA clients, but not this computer. */
Shutdown("All Clients", ProjectRestartGet(), 6, "ClusterXYZ");
See Also