cjexecjob (Execute batch application)
- Organization of this page
Format
- When not using the scheduling functionality is not used
cjexecjob server-name [[Java-option]...] Java-application-class-name [[argument-passed-to-the-main-method]...]
- When using the scheduling functionality
cjexecjob [schedule-group-name] [-jobID job-ID] [[Java-option]...] Java-application-class-name [[argument-passed-to-the-main-method]...]
Function
When not using the scheduling functionality, this command executes batch applications in the batch server with the specified server name.
When using the scheduling functionality, this command executes batch applications in the batch servers that are distributed by CTM. Note that if no batch server exists on which you can execute jobs, the batch applications will be kept waiting in the schedule queue.
The size of each of Java-option and the following arguments is less than 1,024 bytes.
A message is output when you run the cjexecjob command, and when you terminate the cjexecjob command. You can control the message output by the cjexecjob command using the batch.log.stdout.enabled key of usrconf.cfg (option definition file for batch applications).
The options of the cjexecjob command are specified in usrconf.cfg (option definition file for batch applications). The system properties are specified in usrconf.properties (user property file for batch applications). The directories in which usrconf.cfg (option definition file for batch applications) and usrconf.properties (user property file for batch applications) are saved will be searched in the following order:
-
Directory specified in the environment variable (CJBATCHUSRCONFDIR)#
-
Directory in which the cjexecjob command is executed
# In the environment variable (CJBATCHUSRCONFDIR), you specify the directory as the absolute path.
If you specify more than one system properties for the same key, the system property specified last is given priority.
When the system properties of the same key are specified in different ways, the priority order is as follows:
-
Arguments of the cjexecjob command
-
usrconf.properties (user property file for batch applications)
-
usrconf.cfg (option definition file for batch applications)
-
usrconf.properties (user property file for batch servers)
-
usrconf.cfg (option definition file for batch servers)
Arguments
- server-name
-
Specifies the name of the batch server on which batch application is running.
- schedule-group-name
-
Specifies the group name of the batch server to be assigned when the CTM schedules the execution of batch application.
You can also specify the schedule group name using usrconf.cfg (option definition file for batch applications). The following is the priority order for specifying schedule group names:
-
Arguments of the cjexecjob command
-
usrconf.cfg (option definition file for batch applications)
Note that you can omit schedule group names. JOBGROUP is the default value when you omit the specification of the schedule group names.
-
- -jobID job-ID
-
Specifies the job ID of the batch applications to be executed using 1 to 32 unique alphanumeric characters.
If -jobID job-ID is omitted, the job ID is automatically generated. For automatic generation of job IDs, see 4. Scheduling of Batch Applications in the uCosminexus Application Server Expansion Guide.
In UNIX, if you start a batch application by omitting the specification of a job-ID, you must stop the application by specifying the job ID enclosed in double quotation marks ("") as follows:
-jobID "job-ID"
- Java-option
-
Specifies the startup options of JavaVM.
You can specify the following options:
-
-cp
-
-classpath
-
-Dname=value
-
- Java-application-class-name
-
Specifies class names of the Java applications including package name.
- argument-passed-to-the-main-method
-
Specifies arguments passed to the main method of Java applications.
If you omit the specification of schedule-group-name when using the Scheduling functionality, always specify either of the following arguments:
-
Job-ID
-
Java-option
The specification examples are as follows:
(Incorrect example) cjexecjob com.hitachi.mypackage.MyBatchApp argA argB (Correct example) cjexecjob -jobID JOBID com.hitachi.mypackage.MyBatchApp argA argB cjexecjob -D<name>=<value> com.hitachi.mypackage.MyBatchApp argA argB
-
Input examples
- When the scheduling functionality is not used
cjexecjob MyBatchServer com.hitachi.mypackage.MyBatchApp
- When using the scheduling functionality
cjexecjob JOBGROUP com.hitachi.mypackage.MyBatchApp
Return values
- value-returned-from-the-public-static-int-main(String[])-method:
-
This value is returned when the public static int main(String[]) method is used.
- value-specified-in-the-arguments-of-System.exit()-Runtime.halt()-Runtime.exit():
-
This value is returned when the System.exit(), Runtime.halt(), or Runtime.exit() are used.
- 0:
-
The command terminated normally using the public static void main(String[]) method.
- 1:
-
An attempt to execute the batch application has failed.
Additionally, the batch application is terminated forcibly.
Notes
-
In UNIX, the Component Container Administrator who started the batch server or the super user can execute commands.
In Windows, execute commands as a user with administrator privileges.
-
For the server name, specify a case-sensitive character string in conformity with the server name that you have specified while setting up the batch server.
-
When you specify more than one class paths, all the specified class paths will be enabled. For example, when you specify -cp a -cp b, it will be same as -cp a;b (in Windows).
-
Class paths are searched in the specified order. When you specify more than one class paths in different ways, they will be searched in the following order:
-
usrconf.cfg (option definition file for the batch server)
-
Arguments of the cjexecjob command
-
usrconf.cfg (option definition file for batch applications)
You cannot specify class paths in the CLASSPATH environment variable. Even when you specify the class paths, they will be ignored.
Furthermore, if -cp and -classpath are not specified, the current directory is not used as the default class path.
-
-
If a relative path is specified as the class path, it is handled as the relative path from the directory in which the command is executed.
-
When using multi-byte characters in arguments of the cjexecjob command, standardize the encoding with the multi-byte characters used at the following locations:
-
usrconf.cfg (option definition file for batch applications)
-
usrconf.cfg (option definition file for batch severs)
-
Source codes of the batch application (java.lang.System.out or java.lang.System.err in batch applications)
-
-
When you use the scheduling functionality, you can specify the settings for the communication timeout of the cjexecjob command or the batch server using usrconf.cfg (option definition file for batch applications). The default value 0 leads to infinite waiting.