1

I am very new to Ubuntu. I've a mono application deployed on EC2. Currently I use mono folder/app.exe to start the program. How can I make this run when the system reboots?

Thanks in advance.

UPDATE:- In addition to the below answer, I've moved the folder to /opt. Otherwise it was throwing library not found error.

Libin TK
  • 1,477
  • 2
  • 25
  • 46

1 Answers1

3

I'd suggest using upstart. Example:

/etc/init/app.exe.conf

description "My Mono app"

start on runlevel [2345]
stop on runlevel [016]

setuid nobody
setgid nogroup
respawn
console log

exec /path/to/app.exe

It will run your app as user nobody, restart it if it crashes and log all output to /var/log/upstart/app.exe.log. To manually start and stop it you'd use "start app.exe" and "stop app.exe". You can of course name the config file something else, like myapp.conf. See the upstart site for more info: http://upstart.ubuntu.com/

Lars Hansson
  • 366
  • 1
  • 3
  • Tried but I am getting `start: Rejected send message, 1 matched rules; type="method_call", sender=":1.6" (uid=1000 pid=1198 comm="start omega.in.exe ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")` when I start using `start omega.in.exe` – Libin TK Apr 13 '13 at 09:15
  • you need to be root or use sudo when you start it. Example: sudo start omega.in.exe – Lars Hansson Apr 14 '13 at 06:44
  • 1
    I've noticed a Console.ReadLine not keeping the app running using this method. Is there something going on with stdin and upstart that could cause a newline to go to stdin? I'm a Linux newbie... – jjxtra Jul 02 '14 at 21:13