unlock on error and named arrays for config

This commit is contained in:
2021-04-11 17:02:34 +02:00
parent 8a1fe41825
commit 6e25b90915
14 changed files with 138 additions and 49 deletions

View File

@@ -17,6 +17,7 @@ package cmd
import (
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
@@ -26,8 +27,12 @@ var cronCmd = &cobra.Command{
Short: "Run cron job for automated backups",
Long: `Intended to be mainly triggered by an automated system like systemd or crontab. For each location checks if a cron backup is due and runs it.`,
Run: func(cmd *cobra.Command, args []string) {
err := internal.RunCron()
cobra.CheckErr(err)
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
err = internal.RunCron()
CheckErr(err)
},
}