Back to Influxdb

Update

content/shared/influxdb-v2/reference/cli/influx/task/update.md

latest3.4 KB
Original Source

The influx task update command updates information related to tasks in InfluxDB.

Usage

influx task update [task literal] [flags]

Flags

FlagDescriptionInput type{{< cli/mapped >}}
-c--active-configCLI configuration to use for commandstring
--configs-pathPath to influx CLI configurations (default ~/.influxdbv2/configs)stringINFLUX_CONFIGS_PATH
-f--filePath to Flux script filestring
-h--helpHelp for the update command
--hide-headersHide table headers (default false)INFLUX_HIDE_HEADERS
--hostHTTP address of InfluxDB (default http://localhost:8086)stringINFLUX_HOST
--http-debugInspect communication with InfluxDB servers.string
-i--id({{< req >}}) Task IDstring
--jsonOutput data as JSON (default false)INFLUX_OUTPUT_JSON
--skip-verifySkip TLS certificate verificationINFLUX_SKIP_VERIFY
--script-id(InfluxDB Cloud only) Invokable script ID to executestring
--script-params(InfluxDB Cloud only) Invokable script JSON parametersstring
--statusUpdate task status (active or inactive)string
-t--tokenAPI tokenstringINFLUX_TOKEN

Example

{{< cli/influx-creds-note >}}

Update a task from a Flux string
sh
export UPDATED_FLUX_TASK='
  option task = {
    name: "Example Task",
    every: 1d
  }

  from(bucket: "example-bucket")
    |> range(start: -task.every)
    |> filter(fn: (r) => r._measurement == "m")
    |> aggregateWindow(every: 1h, fn: mean)
    |> to(bucket: "default-ds-1d", org: "my-org")
'

influx task update \
  --id 0001234 \
  $UPDATED_FLUX_TASK
Update a task from a Flux file
sh
influx task update \
  --id 0001234 \
  --file /path/to/example-task.flux
Update a task from a script ID
sh
influx task update \
  --id 0001234 \
  --script-id 0004567
Enable a task
sh
influx task update \
  --id 0001234 \
  --status active
Disable a task
sh
influx task update \
  --id 0001234 \
  --status inactive