From ea82fea8e1cc899326a11074d84e66560061e7b9 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Tue, 20 Apr 2021 20:49:09 +0200 Subject: [PATCH] add cron tag --- CHANGELOG | 9 --------- CHANGELOG.md | 26 ++++++++++++++++++++++++++ cmd/backup.go | 2 +- internal/location.go | 7 +++++-- 4 files changed, 32 insertions(+), 12 deletions(-) delete mode 100644 CHANGELOG create mode 100644 CHANGELOG.md diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index c71e492..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,9 +0,0 @@ -# Changelog - -## 1.0.1 - -- Added completion command for various shells - -## 1.0.0 - -- Rewrite in go. See https://autorestic.vercel.app/upgrade for migration. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cfa7650 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,26 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.2] - 2021-04-20 + +### Added + +- Add the `cron` tag to backup to backups made with cron. + +### Fixed + +- Don't unlock lockfile if process is already running. + +## [1.0.1] - 2021-04-17 + +### Added + +- Completion command for various shells + +## [1.0.0] - 2021-04-17 + +- Rewrite in go. See https://autorestic.vercel.app/upgrade for migration. diff --git a/cmd/backup.go b/cmd/backup.go index f789cac..3672bde 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -20,7 +20,7 @@ var backupCmd = &cobra.Command{ CheckErr(err) for _, name := range selected { location, _ := internal.GetLocation(name) - location.Backup() + location.Backup(false) } }, } diff --git a/internal/location.go b/internal/location.go index 4a2ecd7..f3fc35c 100644 --- a/internal/location.go +++ b/internal/location.go @@ -118,7 +118,7 @@ func (l Location) getPath() (string, error) { return "", fmt.Errorf("could not get path for location \"%s\"", l.name) } -func (l Location) Backup() error { +func (l Location) Backup(cron bool) error { colors.PrimaryPrint(" Backing up location \"%s\" ", l.name) t := l.getType() options := ExecuteOptions{ @@ -147,6 +147,9 @@ func (l Location) Backup() error { flags := l.getOptions("backup") cmd := []string{"backup"} cmd = append(cmd, flags...) + if cron { + cmd = append(cmd, "--tag", "cron") + } cmd = append(cmd, ".") backupOptions := ExecuteOptions{ Dir: options.Dir, @@ -291,7 +294,7 @@ func (l Location) RunCron() error { now := time.Now() if now.After(next) { lock.SetCron(l.name, now.Unix()) - l.Backup() + l.Backup(true) } else { colors.Body.Printf("Skipping \"%s\", not due yet.\n", l.name) }