gcd_downloader/gokrazy.go

33 lines
522 B
Go
Raw Normal View History

2023-10-16 02:47:14 -07:00
//go:build gokrazy
package main
import (
"flag"
"log"
"os"
"time"
"github.com/gokrazy/gokrazy"
)
func main() {
gokrazy.WaitForClock()
flag.Parse()
if os.Getenv("GCD_USERNAME") == "" || os.Getenv("GCD_PASSWORD") == "" {
log.Println("Username and password not provided")
os.Exit(0)
}
for {
createDirs()
if shouldUpdate() {
downlod()
log.Println("update complete, waiting 1h to check again")
} else {
log.Println("It's too early, waiting 1h to check again")
}
time.Sleep(time.Hour)
}
}