func main() { fmt.Printf("Starting Greader\n") rreader.OpenDB() if len(os.Args) == 1 { printHelp() return } if os.Args[1] == "import" { fileName := "takeout.zip" if len(os.Args) > 2 { fileName = os.Args[2] } importData(fileName) } if os.Args[1] == "update" { rreader.UpdateFeeds(0) } if os.Args[1] == "web" { go updateRepeat(60) rreader.StartWebserver() } fmt.Printf("Finished Greader") }
func updateRepeat(minutes time.Duration) { for { time.Sleep(time.Minute * minutes) rreader.UpdateFeeds(60 * 6) //6 hours } }