I am very new to Linux and I am currently switching my server from Windows to Centos 6.3. I have written a small UDP server. UDP server was written in C# and now I adopted it to work with Linux using Mono. It is working fine, when I run it this way:
/opt/mono/bin/mono /root/MySoft/UDPServer.exe "$@"
How do I run it automatically--when computer stats? (in windows terms: windows-service)
I tried creating a launcher file and putting it to /etc/init.d
but it did not work
My goto solution for things like this is to install and use supervisord.
Supervisord is a python process supervisor that is very simple to install from your distro's package repo, and simple to configure. You just add a simple config file for your executable and supervisor takes care of starting it up, capturing output, and (optionally) re-starting it if the process fails.
An example config would look like this:
Also, this solution worked:
I added my line of text
/opt/mono/bin/mono /root/MySoft/UDPServer.exe "$@" &
to/etc/rc.d/rc.local