Operation Properties

The following pictures shows the Operation Properties window and its tab options. You can click on "hot spot" areas in each picture below to get detailed information about buttons, controls and fields.

 

Operation Properties (Operation tab -- scroll down for other tabs and examples)
 

  

Name

Identifies the name of an object in the SmartBatch 2009 database. This can be up to 32 characters in any combination used to uniquely identify the object.

Schedule

Select the name of a Schedule that you want assigned to the object. The object will be run according the to Next Run Date and Time defined by the Schedule. Schedules are defined on the Schedule Update window.

Source file

Indicates the name of a file that contains the source for the Operation script or program. This file can be edited using the built-in syntax highlighting source code editor. Click the edit button adjacent to this field to display the editor.

 

Browse Button

Use this button to display the file dialog box where you can select a file or path. Only fixed drives that are local to the Executive Server are displayed.

 

Syntax Editor Button

Displays the syntax editor to show the source code for the Operation. The Source File field is used for the file location. You should specify the file name in the Source File field.

Operation run attributes

Run Priority

Indicates the Run Priority that is used by the Windows operating system to dispatch processes. A process running at a lower priority will get less CPU time than a process running at a higher priority.

User

This must be an Windows Account (that is, a User ID) that the Operation will be authenticated to run under. The As Password field must also be supplied. When the Operation is run by the Executive Server, the Executive Server will start the Operation under the security context of the As User Windows Account.

The As User is used in conjunction with the As Password field to authenticate the Operation to run under a security context that differs from the Executive Server. The Executive Server's security context (that is, Account) is defined in Control Panel under Services.

Working Directory

Specifies the path (e.g., c:\myApp\myPath) of the Working Directory for the Operation. Not all Operations need the Working Directory specified. If you use a Parameter Name in this field, it will be replaced with its value by the Executive Server when the Operation is processed.

Example:

Your Operation runs a .bat script that expects to be run from the folder where the .bat file exists. The .bat file exists in c:\myScripts.

Working Directory: c:\MyScripts

Note: If the working directory is not set, the Operation assumes the working directory of the Executive Server. This will typically be c:\winnt\system32 or equivalent location on your computer.

Password

The Password associated with the As User field. The Password is used in conjunction with the As User (Windows Account) to authenticate the Operation to run under a security context that differs from the Executive Server. The Executive Server's security context (that is, the Account) is defined in Control Panel under Services.

Computer or Computer Group (Enterprise Edition)

A specific computer can be used in an Operation or a Computer Group can be specified. By default, the Operation will run on the computer where the Executive Server is running. In the Standard Edition of SmartBatch the Operation is always run on the Executive Server computer. With the Enterprise Edition you can specify a specific computer or a Computer Group. The Computer Group must have been previously created on the Computer Group Properties window.

Computer Group (Enterprise Edition)

The name of a computer group assigned to the Operation. The Executive Server will determine based on the Computer Group specified which computers) will process the Operation.

Display on desktop

If checked, the Operation will be visible (allowed to interact) with the logged on user's desktop. This capability is provided so that an Operation can display on the desktop when the SmartBatch service is configured under a Specific Account or under System Account when Allow Service to Interact with Desktop is turned off.

Note:  An Operation will also interact with the desktop if the SmartBatch service is configured under System Account and Allow Service to Interact with Desktop is checked.

See Service Environment and Security for a more detailed discussion about services, security and interacting with the desktop.

Warning

The Interact with desktop option is provided primarily for testing purposes.

If a user logs off the desktop that has processes started by the SmartBatch Executive Service, these processes may be stopped by the Windows logoff processing. In addition, you must consider who might be logged on to the computer and if the logged on user should be allowed access to this processing.

 

Description

The description associated with the object name. This can be up to 64 characters in any combination used to describe the object.

Parameter Group

A Parameter Group identifies a set of parameters that can be assigned to an Operation, Step or Job. If you don't want to use a specific Parameter Group and want all Parameters to be used for the object use a Parameter Group of <all>. Parameters are replaced with their value when processed by the Executive Server. Parameters are added to a Parameter Group on the Parameter Group Properties window. Parameters are maintained on the Parameter Properties window.

 

Enabled

Enabled indicates if the object will be processed by the Executive or Notification Servers. Normally all objects are Enabled (that is, checked or set to Yes). However, if you wish to configure an object and not have it processed you can clear the Enabled check box.

For example: If you configure a Schedule and clear the Enabled check box, the Executive Server will not process any of the objects that use the Schedule even if the individual objects are Enabled. If you disable an Operator, the Operator will not receive Notification messages.

 

Run once

If selected, the Operation, Step or Job will be removed from the SmartBatch 2009 database when the Executive Server has completed processing for the object. The provides a convenient way to create an object that will be used one time and then have SmartBatch 2009 automatically removed it from the database.

 

Operation

You enter the Operation into this field. An Operation is any program that you want to run (such as an .exe file, .bat script or windows scripting host .vbs). The Operation can have Parameters that will be replaced when processed by the Executive Server. Example Operations:

Example 1:

Start notepad.exe with the file myfile.txt. @path is a Parameter that specifies the path:

Operation: notepad.exe @path\myfile.txt

Example 2:

Start SQL Server's interactive SQL program using c:\test.sql as input and log to c:\applog.dat:
Operation: isql /SMyServ /Pmypass /ic:\test.sql /oc:\applog.dat

Example 3:

Start a Windows command prompt and have it run a .bat file called d:\batch\nightly.bat:

Operation: cmd.exe /c d:\batch\nightly.bat
or just:
d:\batch\nightly.bat

Browse Button

Use this button to display the file dialog box where you can select a file or path. Only fixed drives that are local to the Executive Server are displayed.

Parameter Button

Causes the Parameter Update window to be displayed. From this window you can maintain Parameters.

Wizard Button

Causes the automation Wizard to be displayed. You can select a Wizard for creating special Operations such as Smart Database Operations.

 

Operation Preview button

Causes the Preview Operation window to be displayed. From this window you can test your Operation to determine if you have configured it correctly. You can replace any Parameters with their values and then run the Operation.

OK button

Closes the window and saves any changes that may have been made.

Done button

Closes the window without saving changes.

Apply button

Causes the changes made on the properties window to be saved. If the Apply button is not enabled, either no changes have been made or the required input has not been completed.

 

Example Operations:

The Operation tab allows you to enter the Operation into the Operation field. An Operation is any program that you want to run (such as a .exe file, a Visual Basic Script, or a .bat file). The Operation can have Parameters that will be replaced when processed by the Executive Server.  

Example Operation:

1.Start notepad.exe with the file myfile.txt. @path is a Parameter that specifies the path where myfile.txt is located.

                    notepad.exe @path\myfile.txt
 

2.Start SQL Server's interactive SQL program using c:\test.sql as input and log to c:\applog.dat:

isql /SMyServ /Pmypass /ic:\test.sql /oc:\applog.dat

3.Start an Windows command prompt and have it run a .bat file called d:\batch\nightly.bat:

cmd.exe /c d:\batch\nightly.bat

Comments:

It is recommended to use Parameters in your Operations for information that could change such as a path or file name.

The full path to the program or script file is necessary unless it is located in the Windows system folder (e.g., c:\winnt\system32).

It is essential that you use the Preview Operation capability to test your Operations.

Use the universal naming convention (UNC) names, if desired, in your Operations and Parameters.

The working directory cannot use UNC naming.

The location of the executable in the Operation cannot use UNC naming.

Cross-system Scheduling (Enterprise Edition)

The ability to specify the computer group you want to run the Operation on is a capability in the Enterprise Edition of SmartBatch.  

 

Operation Properties (On Exit Action tab)

Exit Code Expression

Expression

Tells the Executive Server the regular expression to use when to determine if the Operation was successful. When an Operation exits the Windows operating system obtains an exit code from the Operation's process. This exit code can be examined by the Executive Server using the Exit Code Expression, Condition and Count fields. In most cases an exit code of 0 indicates that the Operation was successful.

Example 1

An exit code of 0 indicates the Operation ran successfully:

Expression: ^0$
Condition: =
Count: 1

Example 2

An exit code of 0 indicates the Operation failed:

Expression: ^0$
Condition: =
Count: 0

In this case notice that count is set to 0 indicating that no match is expected.

Condition

Tells the Executive Server how to compare the Count obtained from the Exit Code Expression. When an Operation exits the Windows operating system obtains an exit code from the Operation's process. This exit code can be examined by the Executive Server using the Exit Code Expression, Condition and Count fields. In most cases an exit code of 0 indicates that the Operation was successful. If 0 indicates success for your Operation, set the Exit Code fields as follows:

Expression: ^0$
Condition: =
Count: 1

Count

Tells the Executive Server how to compare the Count obtained from the Exit Code Expression. When an Operation exits the Windows operating system obtains an exit code from the Operation's process. This exit code can be examined by the Executive Server using the Exit Code Expression, Condition and Count fields. In most cases you will want a match count of 1 or 0. If you are matching for exit code = 0 for example, the match Count should be 1.

Regular Expression Evaluation Button

Use this button to test a regular expression to determine if it meets your needs. This provides a convenient testing mechanism to help ensure that you are using the correct expression. This button is displayed adjacent to fields that support regular expression values.

 

Application Log file

Keyword Expression

The Executive Server examines the value in this field and compares it to the text found in the Application Log file. The comparison uses a regular expression matching.

Example 1

You expect the keyword success to be in the Application Log File when the Operation completes:

Keyword Expression: success
Match case: unchecked
Count: 1
Condition: =

Example 2

You expect the keyword success or the keyword completed to be in the Application Log File when the Operation completes:

Keyword Expression: success|completed
Match case: unchecked
Count: 0
Condition: >

Example 3

An error condition should occur if the keyword error or failed is found to be in the Application Log File when the Operation completes:

Keyword Expression: error|failed
Match case: unchecked
Count: 0
Condition: =

Match case

Identifies the search for regular expression matching to be either case sensitive or not case sensitive. If checked, the matching is case sensitive.

Condition

Tells the Executive Server how to compare the Count obtained from the keyword Expression. When an Operation exits the Executive Server can examine a Log file to determine if the Operation ran successfully. This keyword Expression can be examined by the Executive Server using the keyword Expression, Match case, Condition and Count fields.

Example 1

The Operation is considered to be successful if the word success is found any where in the Log file:

Expression: success
Match case: unchecked
Condition: =
Count: 1

Example 2

The Operations is considered to be successful if the keywords failed and error or not found in the Log file:

Expression: failed|error
Match case: unchecked
Condition: =
Count: 0

Count

Tells the Executive Server how to compare the Count obtained from the keyword Expression. When an Operation exits the Executive Server can determine the success or failure by examining the Application Log file. The Count field is used to determine the number of times a match is found based on the Expression and Match case.

Example

You expect the keyword success to exist in the Application Log file one time:

Expression: success
Match case: unchecked
Condition: =
Count: 1

Application Log File

Identifies the log file name associated with the Operation. This is the file name used by the Operation for logging (that is, writing output). When you enter the Operation you might specify the name of the log file in the Operation.

Example: isql /SMyServ /Pmypass /itest.sql /olog.file

This Operation starts isql with an output file of "log.file". Since SmartBatch 2009 does not have a way to know how each program specifies a log file, you must explicitly set the log file in this field. Not all Operations will use log files. This is one way to determine errors. When the Operation completes, the Executive Server can search through the log file for the keyword expression value that you configure (under the On Exit Action tab).

You can use a Parameter Name in this field. The Parameter Name will be replaced with its value when the Executive Server processes the Operation.

Regular Expression Evaluation Button

Use this button to test a regular expression to determine if it meets your needs. This provides a convenient testing mechanism to help ensure that you are using the correct expression. This button is displayed adjacent to fields that support regular expression values.

 

Run Threshold

Less Than

Indicates the amount of time used by the Executive Server to determine if the Operation ran too short. When the Operation completes the Executive Server will check the time the Operation started against the time the Operation completed. If it ran for a time less than the threshold set in this field, an error condition occurs and a Notification event is generated.

More Than

Indicates the amount of time used by the Executive Server to determine if the Operation ran too long. As the Operation processes the Executive Server will check the time the Operation started against the amount of time the Operation has processed. If it is determined that the Operation has run for an amount of time greater than the time set in this field, an error condition occurs and a Notification event is generated.

Minutes/Seconds

Indicates the units associated with the time value. This is either in minutes or seconds.

 

 

The On Exit Action Tab specifies the conditions that SmartBatch uses to determine if an Operation completed successfully. You have three ways to identify what indicates success or failure for your Operation.

Exit Code Expression

Some programs use exit codes to indicate their success or failure.  SmartBatch can examine the exit code when the Operation completes.

Example:  If the exit code returned by the program is 0 and 0 is the expected successful return value, no error condition occurs. If the exit code returned by the program is not 0, an error condition occurs and a notification event is generated so that someone can be notified.

Note:  The exit code is an integer value reported back to the Windows when a process completes.  Depending on the programming language used the are various ways to report this value to Windows.  Refer to Microsoft Developer Network documentation or the documentation for the programming language you are using.  The expected exit code values may also be provided in the user documentation of any product you are using.  

The Exit Code Expression is a regular expression.  The rules of the regular expression language are used to determine if 0, 1 or more matches have been found.  If the match count is equal to the value indicated in match count, the exit code condition is consider to be a success.  This field can be used in addition to the Keyword Expression field.  However, it is more typical to use either the Keyword Expression capability or the Exit Code.

Keyword Expression

Some applications write information to a log file. This log file, configured in the Log File field, can be searched by SmartBatch when the Operation completes. For example, if the keyword is found (such as SUCCESS), no error condition occurs. If the keyword/string (such as SUCCESS) is not found, an error condition occurs and a notification event is generated so that someone can be notified.

The Keyword Expression is a regular expression. The rules of the regular expression language are used to determine if 0, 1 or more matches have been found.  If the match count is equal to the value indicated in match count, the keyword expression is consider to be a success.  This field can be used in addition to the Exit Code Expression field.  However, it is more typical to use either the Keyword Expression capability or the Exit Code.

Run Time Threshold

An error can be detected if the Operation unexpectedly runs too short or too long an amount of time. SmartBatch keeps track of when the Operation started and the time when it completes. If the run time is too short or too long, an error condition occurs. As an Operation processes, SmartBatch will determine if it has been processing for too long. If so, an error condition occurs and a notification event is generated so that someone can be notified.

Operation Properties (On Error tab)


  

Retry

Number of retries

Tells the Executive Server how many times it should retry an Operation found to be in error.

Number of retries

Tells the Executive Server how long to wait before attempting to retry an Operation found to be in error.

Note: The Executive Server is multithreaded so it continues processing on other objects. It will retry the Operation after the configured number of minutes has elapsed.

 

On Error

On Error

Set the On Error to one of four values depending on how you want the Executive Server to continue processing when the Operation is found to be in error.

1.If you want the Executive Server to continue on error, select Continue. Applies to Operations, Steps and Jobs.

2.If you want the Executive Server to stop processing the object, select this option. The object will remain in the Status until it is removed or resumed.

3.If you want the Executive Server to stop processing and remove the object from the Status, select this option. The object will be scheduled to run again at its next run date and time.

4.If the Operation is processing within a Step that is in a Job, processing will continue with the next Step with this option.

 

Process Object

Process Object

When the Executive Server determines that an object has been found to be in error, the object name and type specified will be processed. The object type can be an Operation, Step, Job or <none>. The default is <none>.

 

This tab indicates how the Executive Server should handle an error condition for the Operation. You can configure SmartBatch to perform one of these actions:

Retry

Retry the Operation after delaying the configured number of minutes.

 Note: Setting an amount of time to delay does not delay other objects that the Executive Server is processing. The Executive Server provides many threads of execution so that it can continue processing many object at the same time.

Alter Processing Flow

Continue processing the next Operation.

Stop processing and leave the Operation in the Status list view on error.

Stop but remove from the Status and schedule the Operation, Step or Job for its next run date and time.

Continue with the next step if processing within a Step and Job.

Process Another Object

Execute a specified object type and name.

Operation Properties (Notification tab)
  

Notification Messages

Additional information can be sent to the Operators on the Alert List by placing the additional text in the Start, Success and Failure fields for the Operation.

History

You can specify to send history to the SmartBatch History, Windows Event Log or a Custom option.  SmartBatch History can be viewed by using the History list view. The Windows Event Log can be view using the Event Viewer tool provided with Windows. You consider initially setting up more logging than you think you may need (that is, log on start, success and failure). This will help you learn how SmartBatch works and understand what is happening as your processing executes. You can always scale back on logging later.

Custom Log (Enterprise Edition)

SmartBatch provides a way to extend the processing capabilities when an Operation starts, stops or is found to be in error. This may be useful for sending status information to network management software such as IBM's Tivoli for example. An Interface for the custom history is provided in the OnLineToolWorks.SmartBatch.Facade assembly that can be used by a programmer.  This feature is provided as with the Enterprise Edition of SmartBatch.

Testing Operations

You can test Operations from the Preview Operation window. This will help assure that the Operation runs correctly when processed by the Executive Server.