Kapacitor: Stream/batch task that runs for a period of time

Hi all.

This is a question on Kapacitor.

Is there currently any way for me to set an effective start and end date for a kapacitor task? This is so that I can restrict it to execute on a certain period of time. E.g. I have a use case where I would like run my tick script for the entire 2017 year and would like it to stop the following year.

I have tried doing --help on kapacitor enable but there isn’t any help available on that section yet. Any idea?

There is no specific way to automatically turn off a task, but there are a few workarounds.

  1. Setup a script that is scheduled to run that disables the task when done.
  2. If its a batch task use the cron method of scheduling the task and specify the year in the cron string so that once 2017 is over it no longer runs even though the task will be enabled. something like `0 0 0 * * * 2017’ will run once an hour for every hour of 2017. See https://github.com/gorhill/cronexpr#implementation for more details.
1 Like

@nathaniel

Noted. Thanks a lot for the advice.