<commit_before>% JOB-V20(5) Rundeck User Manuals | Version 2.0
% <NAME>
% November 20, 2010

# NAME

job-v20 - The 'job' XML file declares job entries for Rundeck.

This is a demonstration document using all possible elements in the
current Rundeck "jobs" XML.

## Loading and unloading

This file can be batch loaded via *rd-jobs* load command:

    rd-jobs load --file /path/to/jobs.xml

Rundeck job definitions can be dumped and saved to a file via
rd-jobs list command:

    rd-jobs list --file /tmp/jobs.xml

# joblist 

The root (aka "top-level") element of the jobs XML file. 

*Nested elements*

[job](#job)*

:    declares a single job

*Example*

    <joblist>
      <job>
       ...
      </job>
      <job>
       ...
      </job>
    </joblist>


## job

The job element is a sub-element of [joblist](#joblist) and defines a job
executable in Rundeck.

The following elements are used to describe the job. Only one of each
element is allowed.

*Nested elements*

[uuid](#uuid)

:    unique UUID to identify the job

[name](#name-1)

:    the job name

[description](#description)

:    the job description

[group](#group)

:    group name

[multipleExecutions](#multipleexecutions)

:    If the job can be executed multiple times simultaneously

[context](#context)

:    command context

[dispatch](#dispatch)

:    dispatch options

[sequence](#sequence)

:    workflow sequence

[notification](#notification)

:    notifications of execution success/failure, via email or webhook

[nodefilters](#nodefilters)

:    node filtering expressions

[loglevel](#loglevel)

:    the logging level

*Job command modes*
     
Jobs execute a sequence of commands. Commands come in several styles:

* System command
* A script
* A script file
* Another defined job

*Examples*

Execute the Unix 'who' command

    <joblist>
      <job>
        <name>who's logged in?</name>
        <description>Runs the unix who command</description>
        <additional/>
        <group>sysadm/users</group>
        <context>
          <project>default</project>
        </context>
        <sequence>
          <command>
            <!-- the Unix 'who' command -->
            <exec>who</exec>
          </command>
         </sequence>
        <nodefilters excludeprecedence="true">
          <include>
            <os-family>unix</os-family>
          </include>
        </nodefilters>
        <dispatch>
          <threadcount>1</threadcount>
          <keepgoing>true</keepgoing>
        </dispatch>
      </job>
    </joblist>

Execute a Bash script

    <joblist>
      <job>
        <name>a simple script</name>
        <description>Runs a trivial bash script</description>
        <additional/>
        <group>sysadm/users</group>
        <context>
          <project>default</project>
        </context>
        <sequence>
          <command>
            <script><![CDATA[#!/bin/bash
    echo this is an example job running on $(hostname)
    echo whatever
    exit 0 ]]></script>
          </command>
         </sequence>
        <dispatch>
          <threadcount>1</threadcount>
          <keepgoing>true</keepgoing>
        </dispatch>
      </job>
    </joblist>

Execute a sequence of other commands, scripts and jobs:

    <joblist>
      <job>
        <name>test coreutils</name>
        <description/>
        <additional/>
        <context>
          <project>default</project>
        </context>
        <sequence>         
         <!-- the Unix 'who' command -->
         <command>
            <exec>who</exec>
         </command>
         <!-- a Job named test/other tests -->
         <command>
            <jobref group="test" name="other tests"/>
         </command>
        </sequence>
        <dispatch>
          <threadcount>1</threadcount>
          <keepgoing>false</keepgoing>
        </dispatch>
      </job>
    </joblist>

## uuid

The UUID is a sub-element of [job](#job). This string can be set manually (if
you are writing the job definition from scratch), or will be assigned at job
creation time by the Rundeck server using a random UUID.  This string should be 
as unique as possible if you set it manually.

This identifier is used to uniquely identify jobs when ported between Rundeck
instances.

## name 

The job name is a sub-element of [job](#job). The combination of  'name'
and  [group](#group) and [project](#project) must be unique if the [uuid](#uuid) identifier is not
included.
     
## description 

The job description is a sub-element of [job](#job) and allows a short
description of the job.

## additional 

The additional element is a sub-element of [job](#job) and provides a
place to declare additional user information. 

## group 

The group is a sub-element of [job](#job) and defines the  job's group
identifier. This is a "/" (slash) separated string that mimics a
directory structure. 

*Example*

    <job>
        <name>who</name>
        <description>who is logged in?</description>
        <group>/sysadm/users</group><commit_msg>Remove old invalid documentation<commit_after>% JOB-V20(5) Rundeck User Manuals | Version 2.0
% <NAME>
% November 20, 2010

# NAME

job-v20 - The 'job' XML file declares job entries for Rundeck.

This is a demonstration document using all possible elements in the
current Rundeck "jobs" XML.

## Loading and unloading

This file can be batch loaded via *rd-jobs* load command:

    rd-jobs load --file /path/to/jobs.xml

Rundeck job definitions can be dumped and saved to a file via
rd-jobs list command:

    rd-jobs list --file /tmp/jobs.xml

# joblist 

The root (aka "top-level") element of the jobs XML file. 

*Nested elements*

[job](#job)*

:    declares a single job

*Example*

    <joblist>
      <job>
       ...
      </job>
      <job>
       ...
      </job>
    </joblist>


## job

The job element is a sub-element of [joblist](#joblist) and defines a job
executable in Rundeck.

The following elements are used to describe the job. Only one of each
element is allowed.

*Nested elements*

[uuid](#uuid)

:    unique UUID to identify the job

[name](#name-1)

:    the job name

[description](#description)

:    the job description

[group](#group)

:    group name

[multipleExecutions](#multipleexecutions)

:    If the job can be executed multiple times simultaneously

[context](#context)

:    command context

[dispatch](#dispatch)

:    dispatch options

[sequence](#sequence)

:    workflow sequence

[notification](#notification)

:    notifications of execution success/failure, via email or webhook

[nodefilters](#nodefilters)

:    node filtering expressions

[loglevel](#loglevel)

:    the logging level

*Job command modes*
     
Jobs execute a sequence of commands. Commands come in several styles:

* System command
* A script
* A script file
* Another defined job

*Examples*

Execute the Unix 'who' command

    <joblist>
      <job>
        <name>who's logged in?</name>
        <description>Runs the unix who command</description>
        <group>sysadm/users</group>
        <context>
          <project>default</project>
        </context>
        <sequence>
          <command>
            <!-- the Unix 'who' command -->
            <exec>who</exec>
          </command>
         </sequence>
        <nodefilters excludeprecedence="true">
          <include>
            <os-family>unix</os-family>
          </include>
        </nodefilters>
        <dispatch>
          <threadcount>1</threadcount>
          <keepgoing>true</keepgoing>
        </dispatch>
      </job>
    </joblist>

Execute a Bash script

    <joblist>
      <job>
        <name>a simple script</name>
        <description>Runs a trivial bash script</description>
        <group>sysadm/users</group>
        <context>
          <project>default</project>
        </context>
        <sequence>
          <command>
            <script><![CDATA[#!/bin/bash
    echo this is an example job running on $(hostname)
    echo whatever
    exit 0 ]]></script>
          </command>
         </sequence>
        <dispatch>
          <threadcount>1</threadcount>
          <keepgoing>true</keepgoing>
        </dispatch>
      </job>
    </joblist>

Execute a sequence of other commands, scripts and jobs:

    <joblist>
      <job>
        <name>test coreutils</name>
        <description/>
        <context>
          <project>default</project>
        </context>
        <sequence>         
         <!-- the Unix 'who' command -->
         <command>
            <exec>who</exec>
         </command>
         <!-- a Job named test/other tests -->
         <command>
            <jobref group="test" name="other tests"/>
         </command>
        </sequence>
        <dispatch>
          <threadcount>1</threadcount>
          <keepgoing>false</keepgoing>
        </dispatch>
      </job>
    </joblist>

## uuid

The UUID is a sub-element of [job](#job). This string can be set manually (if
you are writing the job definition from scratch), or will be assigned at job
creation time by the Rundeck server using a random UUID.  This string should be 
as unique as possible if you set it manually.

This identifier is used to uniquely identify jobs when ported between Rundeck
instances.

## name 

The job name is a sub-element of [job](#job). The combination of  'name'
and  [group](#group) and [project](#project) must be unique if the [uuid](#uuid) identifier is not
included.
     
## description 

The job description is a sub-element of [job](#job) and allows a short
description of the job.

## group 

The group is a sub-element of [job](#job) and defines the  job's group
identifier. This is a "/" (slash) separated string that mimics a
directory structure. 

*Example*

    <job>
        <name>who</name>
        <description>who is logged in?</description>
        <group>/sysadm/users</group>
{'fraction_non_alphanumeric': 0.11080501989592899, 'fraction_numerical': 0.0036730945821854912, 'mean_word_length': 2.381165919282511, 'pattern_counts': {'":': 0, '<': 210, '<?xml version=': 0, '>': 210, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4916395', 'n_tokens_mistral': 2957, 'n_tokens_neox': 2808, 'n_words': 981}