feat: add the ability to execute a cron task on the fly

Closes #4904
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-02 04:53:16 -04:00
parent 798a413096
commit 515994c8d3
11 changed files with 144 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ Additional commands:`
helpContent = `
cron:list <app> [--format json|stdout], List scheduled cron tasks for an app
cron:report [<app>] [<flag>], Display report about an app
cron:run <app> <cron_id> [--detach], Run a cron task on the fly
`
)

View File

@@ -33,6 +33,13 @@ func main() {
appName := args.Arg(0)
err = cron.CommandReport(appName, *format, infoFlag)
}
case "run":
args := flag.NewFlagSet("cron:run", flag.ExitOnError)
detached := args.Bool("detach", false, "--detach: run the container in a detached mode")
args.Parse(os.Args[2:])
appName := args.Arg(0)
cronID := args.Arg(1)
err = cron.CommandRun(appName, cronID, *detached)
default:
err = fmt.Errorf("Invalid plugin subcommand call: %s", subcommand)
}