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

Closes #4904
This commit is contained in:
Jose Diaz-Gonzalez committed 2023-08-05 10:58:57 -04:00
1 parent 798a413096
commit 515994c8d3
11 files changed
+144 -2

No files matched your search

+17
View File
@@ -5,6 +5,7 @@
```
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
```
## Usage
@@ -72,6 +73,22 @@ dokku cron:list node-js-app --format json
[{"id":"cGhwPT09cGhwIHRlc3QucGhwPT09QGRhaWx5","app":"node-js-app","command":"node index.js","schedule":"@daily"}]
```
#### Executing a cron task on the fly
Cron tasks can be invoked via the `cron:run` command. This command takes an `app` argument and a `cron id` (retrievable from `cron:list` output).
```shell
dokku cron:run node-js-app cGhwPT09cGhwIHRlc3QucGhwPT09QGRhaWx5
```
By default, the task is run in an attached container - as supported by the scheduler. To run in a background detached container, specify the `--detach` flag:
```shell
dokku cron:run node-js-app cGhwPT09cGhwIHRlc3QucGhwPT09QGRhaWx5 --detach
```
All one-off cron executions have their containers terminated after invocation.
#### Displaying reports
You can get a report about the cron configuration for apps using the `cron:report` command: