Using the OS Native Definition Type

The OS Native Definition Type uses the default shell of the user that a process runs as. You can specify code in the Source field, just like you can for the CMD or BASH Definition Type.

Note: You must assign at least one Process Server to run OS Native Process Definitions in order to use the OS Native Definition Type.

Variables and Parameters

  • You can manipulate parameters in a Process Definition as variables, using :PARAMETER or the standard target system syntax (Windows %PARAMETER% or UNIX $PARAMETER). A third method for specifying parameters is the REL syntax parameters.PARAMETER (available if the source is REL and starts with =).
  • You can set Out parameters using the native syntax for your shell. For example, you can use set PARAMETER1=value on Windows/CMD and UNIX/csh, or PARAMETER1=value on UNIX/sh. Consult the documentation for the default command line interpreter on your platform for more information.

Note: If you specify :PARAMETER and the parameter PARAMETER does not exist, the string is passed as such to the shell.

Note: Parameters with multi-line values to be executed should be specified using REL syntax (for example, parameters.P_MULTILINE_COMMANDS).

Returning an Error

If a script exits with a non-zero exit code, this is correctly reflected in RunMyJobs. To abort script execution immediately if a command has a non-zero exist status, code a shell-specific exit command (such as set -e in Bourne-based shells, or exit /b on Windows).

OS Independent

You can use the osFamily parameter to determine the type of OS you are running on using REL. This lets you use the right shell to execute code, regardless of which platform the OS process runs on.

Examples

This example shows how to echo parameters.

Copy
echo Hello :NAME
Copy
='echo Hello ' + Logic.case(osFamily, 'windows', '%NAME%', 'unix', '${NAME}', ':NAME')

This example shows how to use a normal environment variable.

Copy
='echo This is running under user :USER with home directory :HOME and temporary directory $TMPDIR.
echo '+osFamily+'
echo '+parameters.Parameter1+'
echo ':Parameter2'

The following shows how to pass numeric (N1), string (S1) and date (D1) parameters to and from BASH scripts.

Copy
='# Note BASH allows no spaces around = in variable assignment
N1=$((expr $N1 + $N1))  # Add numeric variable to itself
S1=":S1 :S1"  # Concatenate string
DTEMP="2023/07/27 23:59:59,000 GMT"
echo You said :D1, I propose :DTEMP
D1=:DTEMP   # Set DateTime to new string value'

This example shows how to return a non-zero exit code, resulting in the process going into Error status.

Copy
='N=1
echo "Exiting with value :N."
exit :N

echo "Not reached"'

This example shows how to use REL to detect the underlying operating system and list the contents of the current directory.

Copy
=Logic.case(osFamily, 'windows', 'dir', 'unix', 'ls', 'dir')