Amazon EC2 - Quartz and Job not working at the right time

I have a Java application deployed on an Amazon EC2 server. I use quartz to plan various tasks.

I tried to plan the task for work at 9 a.m. - I noticed that it was not completed until 10 a.m. Then I tried to complete the task at 9:00 GMT-5 - it was executed at 2 pm GMT, but actually completed it at 15:00 GMT

In the course of further analysis, I noticed that the time on my Amazon server was set in UTC and is an hour behind GMT

I’m just wondering: which part of my setup is not right now, because the tasks are not being performed at the right time?

Does anything need to be specified when installing the cron trigger? I configure Cron in quartz as follows using CronScheduleBuilder

    CronExpression cronExpression = new CronExpression(cronValue);
    TimeZone timeZone = TimeZone.getTimeZone("Etc/GMT-5");
     cronExpression.setTimeZone(timeZone);

     Trigger trigger = TriggerBuilder.newTrigger().withIdentity(triggerName).startNow()
                .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)).build();

        JobDetail job = JobBuilder.newJob(MyCloudTasksServerTaskExecutor.class).withIdentity(taskId.toString())
                .storeDurably(true).build();

Any help is appreciated.

+4
1

, EC2 UTC. GMT .

UTC. . , .

, , , .

, EC2 UTC, .

+3

All Articles