2016-02-08 01:06:54 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
|
2017-08-24 10:36:05 +00:00
|
|
|
"github.com/jpillora/opts"
|
2016-02-09 03:46:45 +00:00
|
|
|
"github.com/jpillora/overseer"
|
|
|
|
"github.com/jpillora/overseer/fetcher"
|
2016-02-08 01:06:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
c := struct {
|
2017-08-24 10:36:05 +00:00
|
|
|
URL string `type:"arg" help:"<url> of where to GET the binary"`
|
|
|
|
Port int `help:"listening port"`
|
|
|
|
NoDebug bool `help:"disable debug mode"`
|
2016-02-08 01:06:54 +00:00
|
|
|
}{
|
|
|
|
Port: 3000,
|
|
|
|
}
|
|
|
|
opts.Parse(&c)
|
2016-02-09 03:46:45 +00:00
|
|
|
overseer.Run(overseer.Config{
|
|
|
|
Program: func(state overseer.State) {
|
2017-08-24 10:36:05 +00:00
|
|
|
//block forever
|
2016-02-08 01:06:54 +00:00
|
|
|
select {}
|
|
|
|
},
|
|
|
|
Address: ":" + strconv.Itoa(c.Port),
|
|
|
|
Fetcher: &fetcher.HTTP{
|
|
|
|
URL: c.URL,
|
|
|
|
Interval: 1 * time.Second,
|
|
|
|
},
|
2017-08-24 10:36:05 +00:00
|
|
|
Debug: !c.NoDebug,
|
2016-02-08 01:06:54 +00:00
|
|
|
})
|
|
|
|
}
|