Specifying a run time for Policies

mbond
New Contributor II

I want to have a policy execute only between 3am and 5am, on the 3rd sunday of the month. (Its a script to delete user home directories on public machines, and that time frame is the only one i can guarantee that the computers will not be in use.)

There is a "Do not execute between" time rule, but if i say from "5am" to "3am" is Casper smart enough to know that that time frame spans 2 days?

Also, i don't see a way to make it only execute on a particular sunday. Using once a month on sunday is likely close enough for the time frame in question (though, twice a year i'll have to remember to turn it off when we are open for 24 hours on the 1st and 2nd sunday of the month). But i need to make sure it executes during the specified time period.

Thanks.

Michael Bond
Professional Technologist
WVU Libraries
Office.: 304-293-0340
Cell....: 304-282-0640
Email.: Michael.Bond at mail.wvu.edu

7 REPLIES 7

Kedgar
Contributor

Sorry Michael, missed posting to the list

You could probably write a script to trigger a policy and stuff it in cron or in a launch daemon.

jarednichols
Honored Contributor

Using a LaunchDaemon controlled by launchd would be preferable. Use of cron is depricated in 10.5 and up. Because of the zillion ways to schedule things in Unix, Apple wants to pull everything under Launch Services. IIRC, in 10.6, if you don't use Launch Services, you don't get the benefits of Grand Central. I may be incorrect on that point though...

j

dustydorey
Contributor III
Contributor III

Personally I'd look at going the route that Jared recommended. If
you've never made your own launch agents or daemons Lingon is a nice
tool for setting them up, and I know it's been mentioned on here before.
Unfortunately the developer has ceased updating of the application. I
used the most recent version numerous times on 10.5 machines but haven't
tried with 10.6. Even if it ceases to function in the near future it
might be a handy way to learn how to put together your own launch
daemons in the meantime.

http://sourceforge.net/projects/lingon/files/

-Dusty-

Dustin Dorey

Technology Support Cluster Specialist

Independent School District 196

Rosemount-Apple Valley-Eagan Public Schools

dustin.dorey at district196.org

651|423|7971

jarednichols
Honored Contributor

There’s a GREAT tutorial on making a launchdaemon here:

http://www.macosxhints.com/article.php?story071102151607110

It deals with automatically loading ipfw rules, but I’m sure you’d get the gist.

j

Not applicable

Why not make use of the scheduled task feature in the JSS? It's pretty flexible in terms of execution times to trigger a policy.
On Dec 21, 2009, at 1:39 PM, Michael Bond wrote:

mbond
New Contributor II

Because i didn't know about Scheduled tasks just now. ;-)

I thought the only way to schedule a policy was via the policy interface. Just put the policy name into the "Policy Trigger" box, correct?

Exactly what I was wanting. Thanks.

Michael Bond
Professional Technologist
WVU Libraries
Office.: 304-293-0340
Cell....: 304-282-0640
Email.: Michael.Bond at mail.wvu.edu

Not applicable

Now it may not be exactly what you need in terms of being that specific ( 3rd Sunday of every month ), but it could be a good first approach.
The scheduled task will then be available as a trigger option for the policy you wish to execute.

For more specific calendaring options within the scheduled task, I'd recommend sending in a feature request into the developers.