Examples: Making SYNCVAL work for you
SYNCVAL={hh:mm|*:mm) sounds more complex than it is. This section will go into a bunch of detail about how it works, but don't let all this verbiage scare you - in the end, SYNCVAL just lets you establish a synchronization point so that you can predict and control when a check is scheduled to run.
Note that in the examples below, we talk about coordinating with INTERVAL. But all this information also applies to EXCEPTINTERVAL.
- CHECKA has a runtime of 1 minute.
- We want CHECKA to every 30 minutes.
- We want CHECKA to run at predictable, synchronized times, starting at 12:00 noon.
ADDREPLACE POLICY(policyname) STMT(GLOBAL)
UPDATE CHECK(CHECKOWNERA,CHECKA)
SYNCVAL(12:00) INTERVAL(00:30)
REASON('Synchronize CHECKA run time')
DATE(20110112)
Once this policy takes effect, the system schedules the check to run at 12:00 and every 30 minutes thereafter, at exactly 12:30, 1:00, 1:30 and so on. If you already have CHECKA defined and running on the system when you set up a policy statement with SYNCVAL for it, you have to refresh your check in order for the initial SYNCVAL start time take effect. However, note that if you add CHECKA in the future, it is synchronized to 15,30,45, and 0 minutes after the hour, even without a REFRESH.
ADDREPLACE POLICY(policyname) STMT(GLOBAL)
UPDATE CHECK(CHECKOWNERA,CHECKA)
SYNCVAL(12:00) INTERVAL(00:15)
EXCEPTINTERVAL(HALF)
REASON('Synchronize CHECKA run time')
DATE(20110112)
Once this policy takes effect, if the check finds an exception the interval time is halved, so that the system schedules the check to run at 12:00 and every 15 minutes thereafter, at exactly 12:15, 12:30, 12:45 and so on.
ADDREPLACE POLICY(policyname) STMT(GLOBAL)
UPDATE CHECK(CHECKOWNERB,CHECKB)
SYNCVAL(00:00) INTERVAL(24:00)
REASON('Make CHECKB run at midnight')
DATE(20110112)
Now, when the policy takes effect,
the check is scheduled to run once a day exactly at midnight. ADDREPLACE POLICY(policyname) STMT(GLOBAL)
UPDATE CHECK(CHECKOWNERC,CHECKC)
SYNCVAL(*:15) INTERVAL(06:00)
REASON('Make CHECKC run at 15 minutes after the hour')
DATE(20110112)
That works. But look out for
the gotchas; SYNCVAL and INTERVAL have to synch up, if you will. For
example, SYNCVAL(*:15) INTERVAL(06:00) will work.
But SYNCVAL(*:15) INTERVAL(00:18) will not work -
you're asking the system to run CHECKC every 18 minutes at 15 minutes
after the hour. SeeSYNCVAL restrictions