a simple url shortener in Go (check it out at qurl.org)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
444 B

4 years ago
4 years ago
4 years ago
  1. package main
  2. import (
  3. "fmt"
  4. "git.binarythought.com/cdramey/qurl/storage"
  5. "os"
  6. "path"
  7. "time"
  8. )
  9. func manageBackup(stor storage.Storage, dir string, interval int) {
  10. for {
  11. time.Sleep(time.Duration(interval) * time.Second)
  12. fname := fmt.Sprintf("qurl-%s.backup",
  13. time.Now().Format("20060102150405"))
  14. err := stor.Backup(path.Join(dir, fname))
  15. if err != nil {
  16. fmt.Fprintf(os.Stderr, "Backup failure: %s\n", err.Error())
  17. }
  18. }
  19. }