Controlled Computer Restart - Best Practices

This topic provides guidelines for a controlled computer shutdown and start.

Daily processing means that numerous tasks are executed on your hosts day and night. If a computer shuts down unexpectedly, running tasks are aborted, which may have a negative impact. You can avoid this by preparing the Agent for shutdowns and restarts.

Adhere to the following basic rules:

The following objects and configurations are required in order to implement these criteria:

  1. The Agent characteristics include two settings that can be used to allow or prevent the start of tasks on an Agent:

    • WORKLOAD_MAX_FT
    • WORKLOAD_MAX_JOB.

    Jobs or File Transfers do not start if "0" is specified in both of them. They wait until a positive value is specified.

    You can do so using the script statement :SET_UC_SETTING. Create two Script objects and specify "0" in one of them and a positive number or "UNLIMITED" in the other one. Use a script variable in order to assign the Agent name to the :SET_UC_SETTING statement. This way you can use the Script objects for any other Agent.

  2. Create two Workflows:

    • One processes finishing tasks before the computer is shut down.
    • The other one is executed immediately after the computer has been restarted in order to process some preparatory tasks.

    Use the script function MODIFY_UC_OBJECT in both Workflows in order to set them to Ignore Agent Resource. This step is required because no other tasks must run at this time. Ignore Agent Resource then applies to all objects that are started by these two workflows.

  3. Ensure that no tasks are active before starting the finishing Workflow.

    Create an Event object that uses the script function SYS_ACTIVE_COUNT to check in an interval of several minutes if there are active tasks on the agent.

    Activate this event before you shut the computer down. It starts the finishing workflow as soon as there are no active tasks on the agent or it activates a notification if there are tasks that have not finished at this point in time.

    In both cases, the Event can end itself using the script function CANCEL_UC_OBJECT.

  4. Create a separate Automation Engine Agent variable for the Agent characteristics. This variable can also be used for several Agents.

    The UC_EX_HOSTCHAR variable assigns them to the corresponding Agent characteristics, see UC_EX_HOSTCHAR - Assigning Agents to Host Characteristics.

    To prevent that tasks start immediately after the Agent has been restarted, set the default values of the WORKLOAD_MAX_FT and WORKLOAD_MAX_JOB validity keys to "0".

    Enter the name of the workflow that should first be executed in the EXECUTE_ON_START option.

    This Workflow's final task must activate a script which sets a higher value than "0" in WORKLOAD_MAX_FT and WORKLOAD_MAX_JOB to ensure that the regular processing of tasks can start.

Before shutting down the computer

After shutting down the computer