

Examples › Planning for system shutdown
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
- 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.
- 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.
- 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');
- 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
- 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:
- Assigns the APPL._user1 variable to a variable named “time”.
- Sets the available count of a threshold resource named ELAPSED to the number of minutes until shutdown.
- Decrements the time variable by 1.
- If the amount of time now left until shutdown is greater than or equal to zero, the server retriggers the Event in one minute. The amount of time left is passed as user parameter 1.
- This recursive procedure repeats until the amount of time left is less than zero.
Jobs requiring the ELAPSED resource will not run unless a sufficient quantity of the resource is available.
Copyright © 2011 CA.
All rights reserved.
 
|
|