Generic Jobs

{"URL":["/*.*/awa/pa_view_JOBS_GENERIC"],"heroDescriptionIdentifier":"ice_generic_jobs","customCards":[{"id":"ice_scripting_and_the_ae_scripting_language","title":"The Automation Engine Scripting Language","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/AE_Scripting_Language.htm","languages":["en-us"]},{"id":"ice_script_processing","title":"Script Processing","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/Script_Processing_Order.htm","languages":["en-us"]},{"id":"ice_writing_scripts","title":"Writing Scripts","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/Script_Writing.htm","languages":["en-us"]},{"id":"ice_working_with_script_editor","title":"Working with the Script Editor","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/obj_Wkg_ScriptEditor.htm","languages":["en-us"]}]}

Use Generic Jobs to define generic, reusable processing steps on any OS Agent. This means that Generic Jobs can be processed on arbitrary host platforms as long as the Agent where they should run is defined. The only prerequisite is that a Generic Job template exists on the target platform. In a fresh Automic Automation installation there are two predefined Generic Job templates (Windows and Unix) in Client 0 but administrators can create as many as needed. Generic Jobs can run independently or they can be added to a Job Group (JOBG) or to a Workflow.

Defining Generic Jobs

A Generic job definition is made up of the following pages:

Generic jobs do not have a platform-specific definition page. The platform in which the Job runs and the Agent that the Jobs uses are parameters that are passed to the object at runtime.

Specifying the Agent

generic jobs

Unlike the other Job types in Automic Automation, you cannot select an Agent on the Attributes page. This is because the Agent must be set via a script using the &AGENT# or &OVERWRITE_AGENT# variables. The values of these parameters can be defined in a PromptSet or can be inherited from a variable. For more information, see Inheriting Object and PromptSet Variables.

Important Considerations

  • The &OVERWRITE_AGENT# variable has a higher priority than &AGENT#. If both variables are defined, the &OVERWRITE_AGENT# is used.

  • The Agent must be defined before the script is processed. Therefore, you cannot use :PSET to set the &OVERWRITE_AGENT# or &AGENT# variables.

  • If you use :PUT_ATT to overwrite the Agent, you must not change the platform. This means that, if your &AGENT# variable has the name of a UNIX Agent, you cannot use :PUT_ATT to set a Windows Agent. This action results in a FAULT_OTHER error message.

  • Generic Jobs do not work with Agent Groups (HOSTG). You cannot set &OVERWRITE_AGENT# or &AGENT# to the name of an Agent group.

Custom Template on the Process Page

generic jobs

The Process page contains a custom template that expects a platform-specific script. This template is a case statement that executes a case block depending on the platform.

Example:

You can build and reuse a single Generic job that takes over all your file renaming tasks.

:SWITCH &$PLATFORM#

:CASE "WINDOWS"

ren "&SRC#" "&DST#"

@set retcode=%errorlevel%

@if NOT %ERRORLEVEL% == 0 goto :retcode

:CASE "UNIX"

mv "&SRC#" "&DST#"

:OTHER

:ENDSWITCH

The following information is passed on to the Job at runtime:

  • Which file must be renamed

  • On which Agent

  • Which Login object will be used to access the target system

The values for the &SRC# (source) and &DST# (destination) and the name of the Login object can be defined in a PromptSet or can be inherited from a variable.

You can use :PUT_ATT on the Pre-Process page to overwrite either of the Agent variables. You can also use :PUT_ATT to set platform-specific attributes.

Example

:SWITCH &$PLATFORM#

:CASE "WINDOWS"

:PUT_ATT WIN_WORK_DIR= "c:\temp"

dir

:CASE "UNIX"

:PUT_ATT UNIX_SHELL= "bash"

ls

:OTHER

:ENDSWITCH

See also: