Added option to run local (rsync) or cloud (rclone) backups, in case you prefer a "full" copy with hardlinks via rsync, or latest/incremental snapshots via rclone
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.metaunix.net/bitgoblin/goblin-store/lib/backup"
|
||||
"git.metaunix.net/bitgoblin/goblin-store/lib/config"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var backupCloudCmd = &cobra.Command{
|
||||
Use: "cloud",
|
||||
Short: "Run cloud forward-incremental backup (via Rclone)",
|
||||
Long: `Uploads changes to a remote or cloud destination using Rclone with forward-incremental backup retention.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
return fmt.Errorf("configuration error: %w", err)
|
||||
}
|
||||
|
||||
return backup.RunIncrementalBackup(cmd.Context(), cfg)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
backupCmd.AddCommand(backupCloudCmd)
|
||||
|
||||
// --workers is defined locally here so it only applies to cloud operations
|
||||
backupCloudCmd.Flags().IntP("workers", "w", 4, "number of concurrent transfer threads")
|
||||
_ = viper.BindPFlag("workers", backupCloudCmd.Flags().Lookup("workers"))
|
||||
}
|
||||
Reference in New Issue
Block a user