|
|
At runtime, _suvi_ is watching a directory for task definition files (default: `./tasks`). Task definitions are noted in `JSON` format with the following elements.
|
|
|
|
|
|
## `type`
|
|
|
|
|
|
Defines the startup strategy of the task.
|
|
|
|
|
|
- `"type": "ondemand"`: Run the task on user interaction or on WebHook calls.
|
|
|
- `"type": "keepalive"`: Automatically start the task with suvi and restart if necessary.
|
|
|
- `"type": "schedule"`: Automatically start the task with suvi if the schedule matches the current system time.
|
|
|
|
|
|
## `exec`
|
|
|
|
|
|
Defines how to start the task.
|
|
|
|
|
|
- `"exec": "system"`: Starts an external executable.
|
|
|
- `"exec": "stop"`: Stops (= kill & reload) tasks by config file name i. e. on a schedule.
|
|
|
- Example: `{ "type": "schedule", "schedule": "* 0 * * *", "exec": "stop", "args": [ "has-to-restart-sometimes" ], "cwd": "/tmp" }`
|
|
|
- `"args"` may contain one or more config files names without the json extension.
|
|
|
- `"exec": "talend"`: Deflates & starts a talend job build to a zip package.
|
|
|
- When using `"talend"` for `"exec"`, this additional config parameters exist:
|
|
|
- `"package"`: Path to the talend build zip file.
|
|
|
- `"java"`: Path to the java binary. When this path to the `java` binary is omitted, the system default will be used.
|
|
|
- The `cwd` parameter is used as base path for deflated jobs. When `cmd` is omitted, the system default temp path is used instead.
|
|
|
- Example: `{ "type": "keepalive", "exec": "talend", "package": "/jobs/talend-demo-job-with-subtask.zip", "args": ["--context=Test", "-Xms256M", "-Xmx1024M"], "cwd": "/tmp", "info": "deflate and keepalive talend demo job" }`
|
|
|
|
|
|
## `args`
|
|
|
|
|
|
Array of startup params or an array of arrays it multiple programs should be started if the previous job succeeded.
|
|
|
|
|
|
- Examples:
|
|
|
- `"args": ["notepad.exe", "test.txt"]`
|
|
|
- `"args": [ ["notepad.exe", "test.txt"], ["calc.exe"] ]`
|
|
|
|
|
|
## `cwd`
|
|
|
|
|
|
Optional startup path for the task
|
|
|
|
|
|
- Example: `"cwd": "C:/temp"`
|
|
|
|
|
|
# `env`
|
|
|
|
|
|
Optional dictionary that extends/overwrites suvis environment variables.
|
|
|
|
|
|
- Example: `"env": {"TAIL_FILE": "/tmp/test"}, "args": ["bash", "-c", "tail -f $TAIL_FILE"]`
|
|
|
|
|
|
## `schedule`
|
|
|
|
|
|
When `"type": "schedule"` is set to launch an instance of the task if not already running. Set it to a cron-like string containg minutes, hours, days, month, weekdays.
|
|
|
|
|
|
- Example: `"schedule": "0 0,4,8,12,16,20 * * 1-5"`: Start Monday to Friday on every four hours.
|
|
|
- Minutes range from `0` to `59`.
|
|
|
- Hours range from `0` to `23`.
|
|
|
- Days range from `1` to `31`.
|
|
|
- Month range from `1` (Jan) to `12` (Dec).
|
|
|
- Weekdays range from `1` (Mon) to `7` (Sun) including `0` (also Sun).
|
|
|
- The crontab syntax element `/` is not supported at the moment.
|
|
|
- `JSON` does not support tab stops in strings, please use simple spaces to separate the `schedule` value.
|
|
|
|
|
|
## `tokens`
|
|
|
|
|
|
Optional list of secret tokens to start a tasks without a password via HTTP GET or POST at `/run/hook/<token>`.
|
|
|
|
|
|
- Example: `"tokens": ["30d827f9-e22f-4b6a-85f1-bcb9977c6155", "69f541f8-614a-45f4-950b-67998c819ee0"]`
|
|
|
|
|
|
## `info`
|
|
|
|
|
|
Optional markdown text to provide task info.
|
|
|
|
|
|
- Line breaks have to be encoded as `\n` in JSON. |