Usage
When SBAL is invoked, the following steps are executed:
- Log4j is configured against the ${batchHome}/conf/${jobName.toLowerCase()}-log4j.xml file. If the file doesn't exists, log4j is configured with a console appender at WARN level.
- A set of properties are loaded,
- From the global property file specified on the command line
- From the ${batchHome}/conf/${jobName.toLowerCase()}-conf.properties file. Properties from the global configuration, can be overrided with the one from the ${batchHome}/conf/${jobName.toLowerCase()}-conf.properties file.
- Spring application context is loaded from the ${batchHome}/conf/${jobName.toLowerCase()}-context.xml file, or from the file specified on the command line with the -c option.
Command line switches
Option |
Description |
Required |
-b,--batch-name jobName |
Specifies the batch/job name |
true |
-h,--batch-home path |
Specifies the batch home directory |
false, default: current directory |
-g,--global-properties path |
Specifies a global configuration file |
false |
-c,--application-context path |
Fixes the spring configuration file |
false, default:
${batchHome}/conf/${jobName.toLowerCase()}-context.xml |
-d,--validate-resource |
Causes resources validations and exit.
The exit status is 0 if all validations are passed. |
false |
-v,--version |
Displays version an exit |
false |
-?,--help |
displays help message and exit |
false |
Command line switches
Samples
A simple usage is made through the net.sf.spring.batch.BatchLauncher class, with at least the -b option, which specifies the job's name.
java -classpath ... net.sf.spring.batch.BatchLauncher -b jobName
In this case:
- The spring application context is loaded from ./conf/jobname-context.xml
- The log4j configuration is loaded from ./conf/jobname-log4j.xml. If the file couldn't be loaded, a minimal configuration is set at WARN level to the console.
- The configuration properties are loaded from ./conf/jobname-conf.properties
You can add job parameters, by using the -D switch on the command line:
java -classpath ... net.sf.spring.batch.BatchLauncher -b jobName -Dname=value
But in most of the cases, you are going to specify the batch home directory, with the -h switch:
java -classpath ... net.sf.spring.batch.BatchLauncher -b jobName -h /home/app/batch -Dname=value
In this case:
- The spring application context is loaded from /home/app/batch/conf/jobname-context.xml
- The log4j configuration is loaded from /home/app/batch/conf/jobname-log4j.xml.
- The configuration properties are loaded from /home/app/batch/conf/jobname-conf.properties
Shell script wrapper
To be done.