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

24
cmd/cron.go Normal file
View File

@ -0,0 +1,24 @@
package cmd
import (
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
"github.com/spf13/cobra"
)
var (
cronCmd = &cobra.Command{
Use: "cron command ...",
Short: "Runs commands defined in config file.",
Long: `Cron executes commands at the time defined in config file.`,
Run: cron,
}
)
func cron(cmd *cobra.Command, args []string) {
opts := backy.NewOpts(cfgFile, backy.UseCron())
opts.InitConfig()
backy.ReadConfig(opts).Cron()
}