Skip to content

Commit

Permalink
Merge pull request #7 from freshteapot/master
Browse files Browse the repository at this point in the history
Improve the readme example.
  • Loading branch information
carlescere committed Jan 9, 2017
2 parents 5e2cc37 + 291305c commit ee74d2f
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions README.md
Expand Up @@ -11,13 +11,32 @@ Inspired by the article **[Rethinking Cron](http://adam.heroku.com/past/2010/4/1

## How to use?
```go
job := func() {
fmt.Println("Time's up!")
package main

import (
"fmt"
"runtime"
"time"

"github.com/carlescere/scheduler"
)

func main() {
job := func() {
t := time.Now()
fmt.Println("Time's up! @", t.UTC())
}
// Run every 2 seconds but not now.
scheduler.Every(2).Seconds().NotImmediately().Run(job)

// Run now and every X.
scheduler.Every(5).Minutes().Run(job)
scheduler.Every().Day().Run(job)
scheduler.Every().Monday().At("08:30").Run(job)

// Keep the program from not exiting.
runtime.Goexit()
}

scheduler.Every(5).Minutes().Run(job)
scheduler.Every().Day().Run(job)
scheduler.Every().Monday().At("08:30").Run(job)
```

## How it works?
Expand Down

0 comments on commit ee74d2f

Please sign in to comment.