Search code examples
amazon-web-servicesspring-bootcronamazon-elastic-beanstalkscheduled-tasks

How to get @Scheduled to run on EC2


I have successfully deployed my spring boot app using Beanstalk but I noticed that it is not running a @Scheduled event that I have as a part of it.

@Scheduled(cron = "0 30 * * * *")
public void getProperStudiesInTable() {
    //some code to execute
}

I have the jar file deployed on Corretto 11 running on 64bit Amazon Linux 2/3.0.1 for the instance. Any advice on how I can get this to run is much appreciated!


Solution

  • I was able to figure out my issue. I needed to ssh into the instance and start the actual server by running

    java -jar application.jar