上运行的EC2实例EC2-运行罐子 [英] EC2- Run jar on running EC2 instance
问题描述
我有一个EC2实例和我有一个的.jar,我已经从S3拿了(wget的脚本命令)。 我要运行这个.jar文件,而不是在启动时,就在我决定的。
I have an EC2 instance and i have a .jar that i already took (wget script command) from S3. I want to run this .jar file, but not on start-up, just when i decide.
我使用的Java与日蚀朱诺与AWS SDK帮助。
I'm using Java with "Eclipse Juno" with help from AWS SDK.
运行用户数据脚本不帮我在这里。
Running a user data script doesn't help me here.
可以有一个人帮助我?
在此先感谢。
推荐答案
您要找的是UNIX cronjobs, 看看在cron作业手册中的这里并将其设置为,只要你想运行。
What you are looking for is unix cronjobs, take a look at the cron job manual here and set it to run whenever you want.
此外,您还可以在系统上安装 WEBMIN ,它给你一个巨大的服务器管理,包括cronjobs和计划命令你通过网页界面需要
also, you can install WEBMIN on your system, it gives you a great server management including cronjobs and scheduled commands as you need via web interface
如果你想运行的东西用java,只要使用
if you want to run something with java, just use
String[] command={"java","-jar","myfile.jar"};
Runtime.getRuntime().exec(command);
这篇关于上运行的EC2实例EC2-运行罐子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!