如何通过cron启动spring批处理远程分区作业?

如何通过cron启动spring批处理远程分区作业?,spring,spring-batch,spring-integration,spring-batch-admin,Spring,Spring Batch,Spring Integration,Spring Batch Admin,我正在使用spring batch和spring batch admin进行日常批处理工作。我已经使用Tomcat7通过SpringBatch管理UI启动了作业,对其进行了测试 我的工作具有跨不同服务器运行的远程分区步骤,我使用rabbitmq作为中间件,spring batch integration用于远程分区 在测试期间,我在所有服务器上部署应用程序,在所有服务器上启动tomcat,以便启动所有侦听器(入站网关并发线程),启动所有bean 现在我想把它移到生产环境中,所以我想把它添加到cr

我正在使用spring batch和spring batch admin进行日常批处理工作。我已经使用Tomcat7通过SpringBatch管理UI启动了作业,对其进行了测试

我的工作具有跨不同服务器运行的远程分区步骤,我使用rabbitmq作为中间件,spring batch integration用于远程分区

在测试期间,我在所有服务器上部署应用程序,在所有服务器上启动tomcat,以便启动所有侦听器(入站网关并发线程),启动所有bean

现在我想把它移到生产环境中,所以我想把它添加到cron中,cron应该会在每天早上4点自动启动作业

1) 有没有办法使用cron启动作业

2) 在这种情况下,我们需要在所有服务器上启动tomcat,还是可以在没有它的情况下运行

3) 若我在一台服务器(主服务器)上启动作业,那个么如何在所有服务器上启动bean、使用者等,以便步骤在所有服务器上作为分区步骤运行

在spring批处理管理示例中,在launch-context.xml中

<description><![CDATA[
  A convenient aggregating config file for running the jobs in this project
  from the command line instead of from the web application.  E.g.

  $ MAVEN_OPTS="-Dbatch.jdbc.url=jdbc:hsqldb:hsql://localhost:9005/samples -Dbatch.data.source.init=false" \
    mvn exec:java -Dexec.classpathScope=runtime \
    -Dexec.mainClass=org.springframework.batch.core.launch.support.CommandLineJobRunner \
    -Dexec.args="classpath:launch-context.xml job1 fail=false run.id=1"


  ]]>
</description>

<import resource="classpath*:/META-INF/spring/batch/bootstrap/**/*.xml" />
<import resource="classpath*:/META-INF/spring/batch/override/**/*.xml" />

<bean id="jobLauncherTaskExecutor" class="org.springframework.core.task.SyncTaskExecutor"/>


我可以在我的用例中使用它吗

该进程需要在所有服务器上运行

一个解决方案是继续使用Tomcat(并让它们一直运行)。您可以使用
spring batch admin
的restapi启动批处理作业(例如,使用
cron
中的
curl

(即将发布)还提供了用于启动批处理作业的RESTAPI