2023-02-02 05:45:23 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
cronCmd = &cobra.Command{
|
2023-02-19 04:42:15 +00:00
|
|
|
Use: "cron [flags]",
|
2023-07-02 02:46:54 +00:00
|
|
|
Short: "Starts a scheduler that runs lists defined in config file.",
|
2023-02-19 04:42:15 +00:00
|
|
|
Long: `Cron starts a scheduler that executes command lists at the time defined in config file.`,
|
2023-02-02 05:45:23 +00:00
|
|
|
Run: cron,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
func cron(cmd *cobra.Command, args []string) {
|
|
|
|
|
2024-11-12 04:44:28 +00:00
|
|
|
opts := backy.NewOpts(cfgFile, backy.CronEnabled())
|
2023-02-02 05:45:23 +00:00
|
|
|
opts.InitConfig()
|
2023-07-02 02:46:54 +00:00
|
|
|
backy.ReadConfig(opts)
|
|
|
|
opts.Cron()
|
2023-02-02 05:45:23 +00:00
|
|
|
}
|