I have a spring project with an archiver job, I want sometimes to invoke it manually from command line, is there an option?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean id="archiverService" class="jobs.service.ArchiverService" />
<bean id="myJob" class="jobs.MyJobs" />
<bean id="archiverJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="cmd.jobs.Archiver" />
<property name="jobDataAsMap">
<map>
<entry key="myJob" value-ref="myJob" />
</map>
</property>
</bean>
<bean id="cronTriggerArchiverJob" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="archiverJob" />
<property name="cronExpression" value="0 0 23 * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="jobDetails">
<list>
<ref bean="archiverJob" />
</list>
</property>
<property name="triggers">
<list>
<ref bean="cronTriggerArchiverJob" />
</list>
</property>
</bean>
</beans>
Yes.
In Quart Examples Page you will find Linux.sh
AND Windows.bat
examples like EXAMPLE1 .
Just replace your JDK installation root.
Basically:
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example1.SimpleExample
example1.sh
#!/bin/sh
# Change this to your JDK installation root
#
#JAVA_HOME=/usr/java/jdk1.6.0_18
JRE=$JAVA_HOME/jre
JAVA=$JRE/bin/java
workdir=`dirname $0`
workdir=`cd ${workdir} && pwd`
QUARTZ=${workdir}/../..
. ${QUARTZ}/examples/bin/buildcp.sh
if [ `uname | grep CYGWIN` ]; then
workdir=`cygpath -w -p $workdir`
fi
LOGGING_PROPS="-Dlog4j.configuration=file:${workdir}/log4j.xml"
$JAVA -classpath $QUARTZ_CP $LOGGING_PROPS org.quartz.examples.example1.SimpleExample
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.