OS Job

OS jobs are used to execute a task on a specific distributed system.

To create an OS job, see Creating a Job.

The following table describes the OS job type attributes.

Attribute

Description

Run as

Defines the operating system account username that is authorized to execute the job.

Rules:

  • Characters: 1–30

  • Case Sensitive: Yes

  • Invalid Characters: Blank spaces and ' (apostrophes).

Type

Determines what the OS job executes, as follows:

  • Script: Executes a script as defined by File Path and File Name

  • Command: Executes an OS command line entry as defined by Command:

  • Embedded Script: Executes a script as defined by Script and File Name.

    Perl, PowerShell, VBScript, and Python languages are supported as embedded scripts, such as:

    • Use #! as the first characters in the first line of the embedded script.

    • Variables defined at the folder level in scripts and embedded scripts are not passed to the job. You must define variables for scripts and embedded scripts at job level.

File Path

Defines the directory where the script file is saved.

Rules:

  • Characters: 1–255

  • Case Sensitive: Yes

  • Invalid Characters: Blank spaces.

  • Variable Name: %%MEMLIB

File Name

Defines the script or embedded script filename.

Rules:

  • Characters: 1–64

  • Case Sensitive: Yes

  • Invalid Characters: Blank spaces, \ (backslashes), / (forward slashes), and * (asterisks).

Command

Defines the command in a Command OS job.

Rules:

  • Characters: 1–512
  • Case Sensitive:

    • UNIX: Yes

    • Windows: No

Script

Defines the script in an Embedded Script OS job.

Rules:

  • Size: 1–64,000 B

  • Case Sensitive: Yes

Embedded Python script:

Copy
#!/usr/bin/python

import sys

if (len(sys.argv) != 3):
   print "Error"
   exit (1)

if (sys.argv[1] != "BMC"):
   print "Error"
   exit (1)

if (sys.argv[2] != "Testing"):
   print "Error"
   exit (1)

print "Correct"
exit (0)

Embedded PowerShell script:

Copy
#!C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe  -File
If ($Args.count -lt 2)
{
   Write-Host "Error"
   Exit 1
}

If ($Args[0] -cne "BMC")
{
   Write-Host "Error"
   Exit 1
}

If ($Args[1] -cne "Testing")
{
   Write-Host "Error"
   Exit 1
}

Write-Host "Correct"
Exit 0

Embedded VBScript:

Copy
#!C:\Windows\System32\cscript.exe
Set myArgs = WScript.Arguments.Unnamed
if myArgs.count <> 2 Then
wscript.echo "Error"
Wscript.Quit
End If

arg1 = WScript.Arguments.Item(0)
arg2 = WScript.Arguments.Item(1)

if strComp (arg1, "BMC") = 0 Then
   if strComp (arg2, "Testing") = 0 Then  
      wscript.echo "Correct"
      Wscript.Quit
   End If
End If
wscript.echo "Error"