> For the complete documentation index, see [llms.txt](https://docs.zirkul.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zirkul.com/devsecops/creating-jobs.md).

# Creating Jobs

Automated tasks in Zirkul are handled by Jobs

Let's say you want to run a security scan automatically every time an application is deployed by your CICD process.

Jobs are used in Zirkul for setting up "recipes" or "playbooks" with the step-by-step instructions to be followed by the Agent.

There's a straightforward syntax used for building your Jobs, here's an example:

```yaml

# Let's load a target by ID
target 150

# Create a new dynamic scan (DAST)
new scan dynamic scan
    targetid: target.id
    subject: 'Dynamic Scan for {{target.name}}'
    status: 'not started'
    url: target.url
    tool name: 'Zirkul Agent'
    submit
    -

# New scan data is stored in the object: scan
# Let's move the scan to 'In progress'
scan scan.id
    status: 'in progress'
    description: 'Scanning Target {{target.id}}'
    update
    -

# Now we can run the scan with Zirkul scanner
scanner
    url scan.url
    start spider
    -

# Update the scan when the scan is completed
scan scan.id
    status: 'completed'
    response message: 'Scan completed successfully'
    update
    -

# Now let's publish all the issues found so you can track them in Zirkul
publish issues

```

You will find more information on how to write Job scripts in the section: Agent CLI

Let's add your first script:

1 - In te section "Continuous Testing \ Jobs", click on "Add Job"

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FJUZgE3N3AOp7D0RmwERa%2Fimage.png?alt=media&amp;token=f7cc7e28-04c0-40ef-b3d5-9b2b89355408" alt=""><figcaption></figcaption></figure>

2 - Fill out the form as follows for creating the classic "Hello world" Job:

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FFv3L9O62nsVqu43tyUcw%2Fimage.png?alt=media&amp;token=85fea398-2a6c-4bd0-b72f-f2b393f5371c" alt=""><figcaption></figcaption></figure>

3 - For executing Jobs, you need the Agent running in service mode connected to Zirkul, [download the Agent](/devsecops/getting-started.md#first-step) and run it with the following command:

```
zirkul --service true --agent cicd --server http://app.zirkul.com --apikey 'YOUR-API-KEY-HERE'
```

If everything is working as expected, you should see something like this:

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FBnjWV42Frf8OUKpoj26r%2Fimage.png?alt=media&amp;token=7e4ed8db-8a57-4470-ae93-5a7d60e803f1" alt=""><figcaption></figcaption></figure>

4 - Let's run the Job from Zirkul clicking the "play" icon:

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FLXkiGo1LA5JdD5a63V1H%2Fimage.png?alt=media&amp;token=98d44f23-7ebd-4227-be83-ed52761c27d9" alt=""><figcaption></figcaption></figure>

You can see the progress clicking the option "View executed jobs"

![](https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2F7NYjMPPhyCZv1ywWtWf1%2Fimage.png?alt=media\&token=a8a278a7-5e59-47d2-9ff3-8813df8614c0)

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FQc8BA92JkPEUXxCGljXe%2Fimage.png?alt=media&amp;token=cae4dc2c-e586-4024-9d6a-3decd4a41a77" alt=""><figcaption></figcaption></figure>

You should also see the Agent running the Job in the command line:

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2FEaPMAi1SkoDe0yWfkBmj%2Fimage.png?alt=media&amp;token=c3ea50f7-7673-4e1b-9149-1456a93e477f" alt=""><figcaption></figcaption></figure>

Once completed, the executed Job should look like this:

<figure><img src="https://3824814822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2TrvRPLIHQjOEfOcBEbb%2Fuploads%2F1cabHnnHeq2FA34wyNpT%2Fimage.png?alt=media&amp;token=f390dad9-a6ac-4d06-a2a2-39a8a60be964" alt=""><figcaption></figcaption></figure>

Of course, this was just a testing exercise, and you don't want to manually execute a Job every time it's needed, in the next section we're going to see the options available for automating the process for running Jobs.
