Ejemplo n.º 1
0
func main() {
	log.Println("start")
	cf, err := config.AppConfig()
	if err != nil {
		log.Fatalln("config load error: ", err)
	}

	cf.Dump()

	util.CheckDir(cf.DownloadDirectory)
	util.CheckDir(cf.ResultDirectory)

	if len(os.Args) == 0 {
		DoFetch(cf)
	} else {
		for _, arg := range os.Args[1:] {
			switch arg {
			case "fetch":
				DoFetch(cf)
			case "parse":
				DoParse(cf)
			case "backup":
				DoBackup(cf)
			default:
				log.Fatalf("unknown arg: \"%s\"", arg)
			}
		}
	}
	log.Println("done")
}
Ejemplo n.º 2
0
func main() {
	log.Println("start")
	cf, err := config.AppConfig()
	if err != nil {
		log.Fatalln("config load error: ", err)
	}

	cf.Dump()

	util.CheckDir(cf.DownloadDirectory)
	util.CheckDir(cf.ResultDirectory)

	DoFetch(cf)
	log.Println("done")
}
Ejemplo n.º 3
0
func DoBackup(cf *config.Config) {
	log.Println("=== BACKUP BEGIN ===")
	srcdir := cf.DownloadDirectory
	dstdir := cf.TempDirectory + "/backup"
	util.CheckDir(dstdir)
	backup.Backup(srcdir, dstdir, "20060102", "")
	//backup.Backup(srcdir, dstdir, "20060102", ".tar.gz")
	backup.Backup(srcdir, dstdir, "20060102", ".zip")
	log.Println("=== BACKUP END ===")
}