Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5961083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:54:55+00:00 2026-05-22T18:54:55+00:00

Is there any way setting crontrigger to begin after a specific date .That is

  • 0

Is there any way setting crontrigger to begin after a specific date .That is crontrigger going to fire after a specific date using its cron expression.I try using crontrigger starttime and firstfire time but not worked.I can do this with using another trigger but i think there should be another way.

this is cron expression

0  0/5  *  * * ? 

i.e. at minutes (5,10,15,…00) not at now+5

this is log program writes

Trigger should start at Fri May 27 21:03:31 EEST 2011 // i expect it run on this time

Job start at  Fri May 27 20:55:00 EEST 2011          //it ignore start time 
Job start at  Fri May 27 21:00:00 EEST 2011
Job start at  Fri May 27 21:05:00 EEST 2011

 public CronTrigger scheduleJob(RemoteJob job, String cronExpression,Date firstFireTime) throws SchedulerException, ParseException {
    JobDetail jobDetail = new JobDetail(job.getDescription(), job.getName(), job.getClass());
    CronTrigger crTrigger = new CronTrigger(
            "cronTrigger", job.getName(), cronExpression);       
    scheduler.scheduleJob(jobDetail, crTrigger);    

    try{
        Calendar  c=Calendar.getInstance();
        c.add(Calendar.MINUTE, 10);
        firstFireTime=c.getTime();
        FileWriter writer=new FileWriter("/opt/scheduler.cron",true);
        writer.write("Trigger should start at " +c.getTime().toString()+"\n\n");
        writer.close();
    }catch(Exception e){

    }
     crTrigger.setStartTime(firstFireTime);
    crTrigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);

    return crTrigger;

}

this is job executed by trigger .

public class ExternalJob extends RemoteJob {

    private static final Logger _logger = Logger.getLogger(ExternalJob.class.getName());
    private static ExternalStorageProcessor processor = new ExternalStorageProcessor();
    private ExternalTask task;
    private static final String tempPath = "/opt/itaptemp/";
    private String name;
    private String description;
    private static final long MARK=1L;

    public ExternalJob(String name, String description) {



    public void execute(JobExecutionContext context) throws JobExecutionException {


         try{
            Calendar  c=Calendar.getInstance();          

            FileWriter writer=new FileWriter("/opt/scheduler.cron",true);
            writer.write("Job start at  " +c.getTime().toString()+"\n");
            writer.close();
        }catch(Exception e){

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:54:56+00:00Added an answer on May 22, 2026 at 6:54 pm

    Set the startTime property to the future Date at which you want the schedule (expression) to start applying.

    I see you say that you tried that and it didn’t work, but it certainly should, so please try again.

        CronTrigger ct = new CronTrigger("foo", "goo", "0 0/10 * * * ?"); // fire every ten minutes, all day every day
    
        // construct a date of March 17, 2012 10:03:00
        Calendar futureDate = Calendar.getInstance(); 
        futureDate.set(Calendar.YEAR, 2012);
        futureDate.set(Calendar.MONTH, GregorianCalendar.MARCH);
        futureDate.set(Calendar.DAY_OF_MONTH, 17);
        futureDate.set(Calendar.HOUR_OF_DAY, 10);
        futureDate.set(Calendar.MINUTE, 3);
        futureDate.set(Calendar.SECOND, 0);
        futureDate.set(Calendar.MILLISECOND, 0);
    
        // use the date as the startTime
        ct.setStartTime(futureDate.getTime());
    
        // check what time the trigger will first fire
        List fireTimes = TriggerUtils.computeFireTimes(ct, null, 1);
        Date firstFireTime = (Date) fireTimes.iterator().next();
    
        System.out.println("First fire time: " + firstFireTime);
    

    This results in:

    First fire time: Sat Mar 17 10:10:00 MDT 2012

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way of setting up an endpoint that does not require Integrated
Is there any way to follow a URL in JavaScript without setting the document.location.href
Is there any way to check whether a file is locked without using a
Is there any way to have something that looks just like a file on
Is there any way of setting an Column Alias in SQL Server? For Example
Is there any way of setting sort order of my properties with model metadata?
Is there any way of setting the name of a thread in Linux? My
Is there any way for setting all the rows of a column to a
Is there any better way of setting the default apache virtual host other than
Is there any way to save the state of vim settings with a document?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.