It is no problem to start an .jar file with java -jar my-jar-file.jar on startup. I only have to put the command in the rc.locale and it works. But how can I start my .jar file as ec2-user on startup? Is that possible?
Asked
Active
Viewed 2,436 times
3
-
Check the usage of "user data" in ec2, http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html – BMW Dec 09 '15 at 23:23
-
Thanks for the hint. I checked it out an tried it with this simple script: `#!/bin/bash java -jar /home/ec2-user/quote-service-1.0-SNAPSHOT-jar-with-dependencies.jar` Am I missing something? Of course there is a break between bash and java – user2925688 Dec 10 '15 at 08:56
-
2nevermind...i solved the problem in a different way: adapted the rc.local file with the command `su ec2-user -c 'java -jar path'` – user2925688 Dec 11 '15 at 13:50
-
Possible duplicate of [Linux Launch java program on startup (EC2 instance)](https://stackoverflow.com/questions/11809191/linux-launch-java-program-on-startup-ec2-instance) – C8H10N4O2 Aug 04 '17 at 17:57