Cicode Programming Reference > Cicode Function Categories > Miscellaneous Functions > Shutdown

Shutdown

Terminates Citect SCADA's operation. Use this function to shut down the Citect SCADA system, otherwise buffered data could be lost. This function impacts the operation of the computer as a whole, it is not process-based. If a computer is the target for shutdown, all Citect SCADA processes on the computer will be shutdown.

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 Citect SCADA 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 Citect SCADA 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] [, sClusterName] [, CallEvent])

sDest:

The destination computer(s) on which Citect SCADA will be shut down, as a string:

"" (blank string) - this computer only (default value).

["Computer_Name"] - a specified Citect SCADA computer. Use the name defined in the computer's CITECT.INI file. If this is not configured, you can use the Windows computer name.

["Server_Name"] - a specified Citect SCADA server computer. Shutdown will only work if the specified server is the only one configured on the computer.

"All Clients" - All Citect SCADA client computers on the network.

"All Servers" - All Citect SCADA server computers on the network.

"Everybody" - All Citect SCADA 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 Citect SCADA only - Default value.

2 - Shutdown and restart Citect SCADA (without logging off Windows).

3 - Shutdown and restart Citect SCADA and log off Windows (an auto login to the Operating System and Citect SCADA needs to be configured to run on start up or log in).

4 - Shutdown Citect SCADA and re-boot the computer.

5 - Shutdown Citect SCADA only.

6 - Shutdown and restart Citect SCADA on remote computers, but not this computer.

7 - Shutdown Citect SCADA and shutdown the computer. If the computer supports power off feature the power will be turned off.

sClusterName:

The name of the cluster to which the machine(s) named in Dest belong. 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 code is returned.

Related Functions

ProjectRestartGet, ProjectRestartSet, ProjectSet, ShutdownMode, ShutdownForm, OnEvent

Example

/* Shut down Citect SCADA on this computer. */
Shutdown();
/* Shut down and restart Citect SCADA clients, but not this computer. */
Shutdown("All Clients", ProjectRestartGet(), 6, "ClusterXYZ");

See Also

Miscellaneous Functions

Published June 2018