Shutdown
- Last UpdatedFeb 19, 2025
- 4 minute read
Terminates Plant SCADA's operation. Use this function to shut down the Plant 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 Plant 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 Plant 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. Set this parameter to 0 for all the computers that will send or accept a shutdown command.
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 Plant 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 Plant SCADA will be shut down, as a string:
• "" (blank string) - this computer only (default value).
• ["Computer_Name"] - a specified Plant 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 Plant SCADA server computer. Shutdown will only work if the specified server is the only one configured on the computer.
• "All Clients" - All Plant SCADA client computers on the network.
• "All Servers" - All Plant SCADA server computers on the network.
• "Everybody" - All Plant 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 Plant SCADA only - default value.
2 - Shutdown and restart Plant SCADA (without logging off Windows).
3 - Shutdown and restart Plant SCADA and log off Windows. An auto login to the operating system and Plant SCADA needs to be configured to run on start up or log in. Not supported when Plant SCADA is running as a service.
4 - Shutdown Plant SCADA and re-boot the computer. Not supported when Plant SCADA is running as a service.
5 - Shutdown Plant SCADA only (the same as mode 1).
6 - Shutdown and restart Plant SCADA on remote computers, but not this computer.
7 - Shutdown Plant SCADA and shutdown the computer. If the computer supports power off feature the power will be turned off. Not supported when Plant SCADA is running as a service.
sClusterName:
The name of the cluster to which the machine(s) named in Dest belong. This is not required if:
• the function is called with Dest empty (the default); OR
• the client is connected to only one cluster containing an Alarm Server.
CallEvent:
Flag for initiating a user-specified shutdown event prior to shutting down. Refer to OnEvent() type code for the value of shutdown event.
0 - no event
1 - raise event. The user defined shutdown event handler will be called before the shutdown occurs - Default value
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 Plant SCADA on this computer. */
Shutdown();
/* Shut down and restart Plant SCADA clients, but not this computer. */
Shutdown("All Clients", ProjectRestartGet(), 6, "ClusterXYZ");