开发者

start a program when EC2 linux instance boot

开发者 https://www.devze.com 2023-03-31 09:02 出处:网络
I have a program written in c# and want it to start when my instance start. I already added \"开发者_如何学Cmono /home/ec2-user/program/program.exe\" to /etc/rc.local but it does nothing.

I have a program written in c# and want it to start when my instance start.

I already added "开发者_如何学Cmono /home/ec2-user/program/program.exe" to /etc/rc.local but it does nothing. What do I have to do?


Consider using cloud-init (if you are using Ubuntu), or a user-data start script. These will allow you to start an instance, configure it how you like (with necessary packages like mono), download your own code, and have it run as soon as the instance starts.

This is a preferred way to re-using instances or repackaging instances since all the steps needed to transform a 'stock' image to your own customized one is automated.


@vsekhar is correct, as far as I am aware, regarding what happens when the instance is restarted. In that case, a daemon is about the best that can be done.

However, as all information in RAM is lost, it is often okay to just reboot. You can start the instance and reboot, allowing for normal processing of startup scripts. For rebooting, you can use ec2-reboot-instances.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号