-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
42 lines (36 loc) · 810 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"flag"
"fmt"
"os"
)
var (
cronfile = flag.String("i", "", "import from crontab file.")
host = flag.String("s", "0.0.0.0", "bind to ip address.")
port = flag.Int("p", 8080, "port to listen.")
dbfile = flag.String("d", "skeddy.db", "use existing storage.")
)
var Store *Storage
func main() {
flag.Parse()
var err error
Store, err = NewStorage(*dbfile)
if err != nil {
fmt.Println("ERROR:", err)
return
}
defer Store.Close()
if len(*cronfile) != 0 {
err := ImportFile(*cronfile)
if err != nil {
fmt.Fprintln(os.Stderr, "ERROR:", err)
} else {
fmt.Fprintf(os.Stdout, "Import of %s complete ...\n", *cronfile)
go StartScheduler()
StartAdminInterface(*host, *port)
}
} else {
go StartScheduler()
StartAdminInterface(*host, *port)
}
}