title: Where to put quartz scheduler to only kick off once
body: <p>I have two scheduled jobs with quartz. One on application side and one on client size. It is a very simple set up but I am obviously missing the basics of the how this works as I have checked their documentation and several other sites.</p>
  
  <p>I have two separate classes, one for the job and one for the trigger. These classes on application side are working but not on the client side. They are both identical in function, spitting out logs for testing. When my client side gets called does a particular job and shuts down. Quartz which is scheduled to spit out a file a minute spits out one and dies with the application. I actually manually call the scheduler by</p>
  
  <pre><code>ScheduledJobTrigger sjt = new ScheduledJobTrigger();
  
               sjt.doJob(); 
  </code></pre>
  
  <p>in my application logic.</p>
  
  <p>This surely can't be the way the scheduler is kicked off as it would just reset the time every time the client is called. My aim is for the application to produce a file every 24 hours but can't get my head around how the trigger is pulled or how it works after the client servelett element of the application is finished. I realize I am going to get flack for the way this post is phrased but appreciate any help to the ignorant.</p>
  
  <p>Edit:</p>
  
  <pre><code>public class FileCreationJob implements Job {
       private static final Logger log = LoggerFactory.getLogger(FileCreationJob.class);
      public void execute(JobExecutionContext context) throws JobExecutionException {
          // TODO Auto-generated method stub
          JobKey jobKey = context.getJobDetail().getKey();
          System.out.println("Scheduler Scheduling........"+ jobKey);
           if (log.isDebugEnabled()) log.debug("SCHEDULER&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;("+jobKey+")");
  
  
      }
  
  }
  </code></pre>
  
  <p>The actual job itself.</p>
  
  <pre><code>public class ScheduledJobTrigger {
      public void doJob() throws Exception {
  
          SchedulerFactory schedFact = new StdSchedulerFactory();
  
          Scheduler sched = schedFact.getScheduler();
          sched.start();
  
          JobDetail job = JobBuilder.newJob(FileCreationJob.class)
                  .withIdentity("FileCreationJob", "FirstJob").build();
  
          Trigger trig = TriggerBuilder
                  .newTrigger()
                  .withIdentity("FileCreationJobTrigger", "FirstJob").startNow()
                  .withSchedule(
                          SimpleScheduleBuilder.simpleSchedule()
                                  .withIntervalInMinutes(1).repeatForever())
                  .build();
  
          sched.scheduleJob(job, trig);
  
  
  
      }
  }
  </code></pre>
  
  <p>My first misunderstanding is how this is all supposed to be kicked off once and only once. I eventually want it to kick off a job once every 24 hours and if my application calls it everytime it kicks off then it will just reset the scheduled time paramater. i.e. If I wanted it to kick off at 3, the next time the application is called it will reset the time</p>