crontab.go 449 B

123456789101112131415161718192021
  1. package cmd
  2. import (
  3. "kpt-pasture/config"
  4. "kpt-pasture/dep"
  5. "gitee.com/xuyiping_admin/pkg/svcutil"
  6. "github.com/spf13/cobra"
  7. )
  8. // CrontabCmd represents the crontab command
  9. var CrontabCmd = &cobra.Command{
  10. Use: "crontab",
  11. Short: "计划任务",
  12. Run: func(cmd *cobra.Command, args []string) {
  13. svcutil.WaitFor(config.Options().HTTPServerAddr, func(stop <-chan struct{}) error {
  14. dep.DICrontabService().Run(stop)
  15. return nil
  16. })
  17. },
  18. }