cron-0.5.0: Cron datatypes and Attoparsec parser

Copyright(c) Andrew Rademacher 2014
LicenseMIT
MaintainerAndrew Rademacher <andrewrademacher@gmail.com>
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

System.Cron.Schedule

Description

main :: IO ()
main = do
       ...
       tids <- execSchedule $ do
           addJob job1 "* * * * *"
           addJob job2 "0 * * * *"
       print tids
       ...

job1 :: IO ()
job1 = putStrLn "Job 1"

job2 :: IO ()
job2 = putStrLn "Job 2"

Synopsis

Documentation

data Job Source

Scheduling Monad

Constructors

Job CronSchedule (IO ()) 

Instances

class MonadSchedule m where Source

Methods

addJob :: IO () -> String -> m () Source

Instances

execSchedule :: Schedule () -> IO [ThreadId] Source

Schedule all of the jobs to run at appropriate intervals. Each job that is launched gets a scheduling thread to itself. Each time a scheduling thread launches a job, the job is forked onto a new thread. This means that if a job throws an excpetion in IO, its thread will be killed, but it will continue to be scheduled in the future.