Libin TK
Libin TK

Reputation: 1497

How do I add my mono Program to the startup?

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.

Upvotes: 1

Views: 1516

Answers (1)

Lars Hansson
Lars Hansson

Reputation: 416

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/

Upvotes: 3

Related Questions