I have a program written in c# and want it to start when my instance start.
I already added "mono /home/ec2-user/program/program.exe" to /etc/rc.local but it does nothing. What do I have to do?
preguntado el 27 de agosto de 11 a las 14:08
Considera usar 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