Skip to main content
Version: 4.2.0

How to Create a Scheduled Event-Based Job

Jobs allow you to define automations in Fix Inventory and can be triggered on a regular schedule after collect_and_cleanup workflow steps fire events.

Prerequisites​

This guide assumes that you have already installed Fix Inventory.

Directions​

  1. Define the action you would like to automate. For example, let's say we want to clean up development accounts at the end of each week:

    > search is(instance) in ["dev", "playground"] | clean
    tip

    See Search How-To Guides for guidance on how to write search queries.

  2. Determine the job schedule and define it using a cron expression. For example, if we want to run the job every Friday at 10pm:

    0 22 * * FRI
  3. Determine the event trigger for the job. In this case, since we want to send an alert as soon as a publicly accessible database is detected, we'll use the cleanup_plan event to trigger the job.

  4. Now that we've defined the action and decided on the trigger, create the job using the job add command (replace the value of the --id parameter with a unique job identifier):

    > job add --id weekly_dev_cleanup --schedule "0 22 * * FRI" --wait-for-event cleanup_plan 'search ... | clean'

Further Reading​