How do I add my mono Program to the startup?

為{幸葍}努か 提交于 2019-12-24 11:13:03

问题


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.


回答1:


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/



来源:https://stackoverflow.com/questions/15983413/how-do-i-add-my-mono-program-to-the-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!