Controlled Computer Restart

Guideline for a monitored computer shutdown and start.

General

Daily processing means that numerous tasks are executed on your hosts day and night. Running tasks are aborted if a computer shuts down unexpectedly. In order to avoid negative impacts, Automic recommends preparing the agent for shutdowns and restarts.

Preparations

The following basic rules apply:

1.

Ensure that no tasks are active when you shut down the computer.

2.

Execute a workflow that processes finishing tasks shortly before you shut down.

3.

Tasks should not start immediately after the agent has started.

4.

Instead, execute a workflow that processes some preparatory tasks.

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

  1. The host characteristics include two settings that can be used to allow or prevent the start of tasks on an agent. These settings are WORKLOAD_MAX_FT and WORKLOAD_MAX_JOB. Jobs or file transfers do not start if the value "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 the value "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 statement :SET_UC_SETTING. In doing so, you can use the created Script objects for any number of agents.
  2. Create two workflows. One serves to process finishing tasks before the computer is shut down and the other one should be executed immediately after the computer has been restarted in order to process some preparatory tasks. Use the function MODIFY_UC_OBJECT in the scripts of 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 in order 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 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 AE agent variable for the host characteristics. This variable can also be used for several agents. The variable UC_EX_HOSTCHAR  assigns them to the corresponding host characteristics. Set the default value for the host characteristics' validity keys WORKLOAD_MAX_FT and WORKLOAD_MAX_JOB  to "0" in order to prevent that tasks start immediately when the agent has been restarted. Enter the name of the workflow that should first be executed in the option EXECUTE_ON_START. This workflow's final task must activate a script which sets a higher value than "0" for the settings WORKLOAD_MAX_FT and WORKLOAD_MAX_JOB in order to ensure that the regular processing of tasks can start.

Procedure

Before shutting down the computer:

After starting the computer: