added some features

- Added `cron` command to run lists with `cron` time specifed
- Changed `-c` flag to `-f` flag for passing config file
- Modified some config keys
  - cmdArgs -> Args
  - Got rid of `hosts.config`
- better SSH handling
  - respects values in config file
This commit is contained in:
2023-02-01 23:45:23 -06:00
parent 03f54c8714
commit 059f4c0097
19 changed files with 1359 additions and 786 deletions

View File

@ -1,8 +1,11 @@
// backup.go
// Copyright (C) Andrew Woodlee 2023
// License: Apache-2.0
package cmd
import (
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
"git.andrewnw.xyz/CyberShell/backy/pkg/notification"
"github.com/spf13/cobra"
)
@ -18,17 +21,17 @@ var (
)
// Holds command list to run
var cmdList []string
var cmdLists []string
func init() {
backupCmd.Flags().StringSliceVarP(&cmdList, "lists", "l", nil, "Accepts a comma-separated names of command lists to execute.")
backupCmd.Flags().StringSliceVarP(&cmdLists, "lists", "l", nil, "Accepts a comma-separated names of command lists to execute.")
}
func Backup(cmd *cobra.Command, args []string) {
config := backy.ReadAndParseConfigFile(cfgFile, cmdList)
notification.SetupNotify(*config)
config.RunBackyConfig()
backyConfOpts := backy.NewOpts(cfgFile, backy.AddCommandLists(cmdLists))
backyConfOpts.InitConfig()
config := backy.ReadConfig(backyConfOpts)
config.RunBackyConfig("")
}