Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

User defined

...

parameters in shell scripts

  • Job

...

  • parameters and order

...

  • parameters are accessible by

...

  • environment variables.
  • There is a simple rule for the

...

  • naming of

...

  • environment variables: 
    • the name of the environment variable

...

    • for a parameter is SCHEDULER_PARAM_NAMEOFPARAM.

...

    •  
    • for example the job parameter param1 is available by the environment variable SCHEDULER_PARAM_PARAM1

...

    • environment variables are used with uppercase letters

 

Code Block
languagexml
titleExample for Windows

Example

for Windows

Code Block

 <job>
    <params>
        <param name="param1"  value="Test"/>
    </params>
    <script language="shell">
        <![CDATA[
 rem This is an example shell script to demonstrateshow the use of parameters
 echo Param1 has the value %SCHEDULER_PARAM_PARAM1%
        ]]>
    </script>
    <run_time/>
 </job>
Code Block
languagexml
titleExample for

...

code
Unix

 <job>
    <params>
        <param name="param1" value="Test"/>
    </params>
    <script language="shell">
        <![CDATA[
 # This is an example shell script to demonstrateshow the use of parameters
 echo "Param1 has the value $SCHEDULER_PARAM_PARAM1"
        ]]>
    </script>
    <run_time/>
 </job

 

If you want to use the parameters as parameters for a script in the command - line then just append the Names to the Scriptnameadd the environment variables when calling the script:

Code Block
languagebash
titleExample for command line (Unix)

  anyshellscript.sh $SCHEDULER_PARAM_PARAM1 $SCHEDULER_PARAM_PARM2 ...

Setting Parameter in Shell-Scripts and put them to the next node in job chains.

...

Passing parameters to subsequent shell jobs in a job chain

  • With every change of status in job chains

...

  • JobScheduler parses a temporary file for

...

  • name=value

...

  • pairs.

...

  •  
    • The name of the temporary file is available with the environment variable SCHEDULER_RETURN_VALUES
    • The name/value pairs are automatically added as order parameters

.

Code Block
languagexml
titleExample for First Job
Code Block

 <job order="yes"
     stop_on_error="no">
    <params>
        <param name="param1"  value="Test"/>
    </params>
    <script language="shell">
        <![CDATA[
 rem This is an example shell script to demonstrate the use of parameters 
 echo newParam=an example value >> %SCHEDULER_RETURN_VALUES%
        ]]>
    </script>
    <run_time/>
 </job>
Code Block
languagexml
titleExample for Second Job

...

code

 <job order="yes"
     stop_on_error="no">
    <params>
        <param name="param1" value="Test"/>
    </params>
    <script language="shell">
        <![CDATA[
 echo newParam has the value %SCHEDULER_PARAM_NEWPARAM%
        ]]>
    </script>
    <run_time/>
 </job>
Code Block
languagexml
titleExample for Job Chain
Code Block

 <job_chain>
    <job_chain_node state="100"
                    job="job_sample_shell_with_parameter"
                    next_state="200"
                    error_state="error"/>
    <job_chain_node state="200"
                    job="job_sample_shell"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>

...

Related Downloads

see also:

...