mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2025-09-06 10:30:39 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
ea82fea8e1 | |||
a35edcaea5 | |||
86d44eafad | |||
e927fd5a64 | |||
d5e13d4e27 |
26
CHANGELOG.md
Normal file
26
CHANGELOG.md
Normal file
@@ -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.
|
@@ -20,7 +20,7 @@ var backupCmd = &cobra.Command{
|
||||
CheckErr(err)
|
||||
for _, name := range selected {
|
||||
location, _ := internal.GetLocation(name)
|
||||
location.Backup()
|
||||
location.Backup(false)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const VERSION = "1.0.1"
|
||||
const VERSION = "1.0.2"
|
||||
|
||||
var CI bool = false
|
||||
var VERBOSE bool = false
|
||||
|
@@ -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)
|
||||
}
|
||||
|
@@ -1,10 +1,11 @@
|
||||
package lock
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path"
|
||||
"sync"
|
||||
|
||||
"github.com/cupcakearmy/autorestic/internal/colors"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@@ -33,7 +34,8 @@ func setLock(locked bool) error {
|
||||
if locked {
|
||||
running := lock.GetBool("running")
|
||||
if running {
|
||||
return errors.New("an instance is already running")
|
||||
colors.Error.Println("an instance is already running. exiting")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
lock.Set("running", locked)
|
||||
|
Reference in New Issue
Block a user