We're trying to work with AWS EC2 auto scaling groups. We created an instance, set up like we need with ubuntu 16.04 and all the software we need, then made an image from that instance. We then created a launch configuration and auto scaling group from it. All is fine at that point and we see the instances being created.

The problem is that we have some cronjobs that need to work at reboot and every 5 minutes but they do not work until we ssh in into the newly created instance at least once. Everything else is working fine, tomcat is running and the cronjobs starts working if we ssh into it, but we want this to be automated. Note that we just need to ssh into the instance for the cronjobs to start working, we don't even need to enter crontab -e.

Can anyone help with this?

  • Check the system logs. – Michael Hampton Feb 17 '17 at 23:46
  • could you paste the crontab here? – Putnik Feb 18 '17 at 11:06
  • Here is the cronjob that really need to be working and is not, until we ssh in. */5 * * * * sudo /usr/local/bin/checkportal.sh I checked the permissions on this script, everything is in order and what this script does is just check if our website return 404, then restart tomcat. – Redempter Feb 18 '17 at 22:38
  • Maybe you should look into why Tomcat fails. Alternately you can skip this health check and have it done by the auto scaling group - if it reports unhealthy it'll be removed from the group and replaced. – Tim Feb 19 '17 at 18:09
  • Actually Tomcat is working fine but it's just the root app that is failing to start on new instances, everything else works fine. I guess I'll try to dig deeper why the root app is not starting. – Redempter Feb 19 '17 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.