the work library has a function which it describes as 'cron for clojure functions':
https://github.com/clj-sys/work.git cant say i have used it, but i noticed it in there recently whilst looking for other things. here is the function: (defn schedule-work "schedules work. cron for clojure fns. Schedule a single fn with a pool to run every n seconds, where n is specified by the rate arg, or supply a vector of fn-rate tuples to schedule a bunch of fns at once." ([f rate] (let [pool (Executors/newSingleThreadScheduledExecutor)] (.scheduleAtFixedRate pool (with-log f) (long 0) (long rate) TimeUnit/SECONDS) pool)) ([jobs] (let [pool (Executors/newSingleThreadScheduledExecutor)] (doall (for [[f rate] jobs] (schedule-work pool f rate))) pool))) hope that is useful, cheers gaz On Fri, Jan 7, 2011 at 11:13 AM, Trevor <tcr1...@gmail.com> wrote: > What's the best way to kick off Clojure code at scheduled times? I > have some that would run once a day. Some that might run 2 or 3 times > a day based upon a test being met. > > 1. I could write a function that sleeps an interval, check the time > differential to perform a time-box triggered function, but would that > consume too much memory?, cause long term problems? > > 2. I could use quartz, but that seems like overkill. > > 3. I could set a job-schedule using the OS to run a clojure script. > I'd rather not, I would like to do things like send emails / check > status via web app (making option 1 more appealing). > > I'm looking for input/guidance. What are your experiences? > > Thanks, > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en