Previous Topic: Running mutually exclusive groups of jobsNext Topic: Using job completion as a resource


Planning for system shutdown

Objective

When a particular system is due to be shut down, long-running jobs should be prevented from starting and notification needs to be provided.

Solution

To plan for a system shutdown

  1. In the Services perspective, define a threshold resource named ELAPSED representing elapsed time in minutes.

    Initially, you can assign ELAPSED a Maximum availability count such as 1440 to represent 24 hours.

  2. Specify the ELAPSED resource as a dependency for the long-running jobs you want to prevent from starting prior to system shutdown.

    For example, if a job usually runs for 2 hours, specify the job requires 120 units of the ELAPSED resource.

  3. Set up an Application with a countdown procedure that you can use prior to a system shutdown. You can use a link that runs the following JavaScript script at Event trigger time to set the available count of the resource and then retrigger itself one minute later:
    time=APPL._user1;
    resetResourceProperty('ELAPSED','Availability',time);
    APPL.remain=(time - 1).toFixed(0);
    if (APPL.remain >= 0)
      execTrigger('%APPL._event','','now plus 1 minute','','%APPL.remain');
    
  4. Indicate that an SNMP trap should be sent when the link becomes ready. Customize the message to indicate the number of minutes until shutdown, for example:
    System shutdown in %remain minutes
    
  5. Define an Event (for example, OPER.SHUTDOWN) that runs your Application. When you trigger this Event, specify the number of minutes until shutdown in the Parameter 1 field.

Explanation

When you trigger the Event, you pass the number of minutes until shutdown.

The Application run by the Event contains a link that does the following:

Jobs requiring the ELAPSED resource will not run unless a sufficient quantity of the resource is available.