-1

I am very new in Linux (first day). I needed to add my program to the OS startup. I could not find a solution, so I tried to do something that could solve my issue.

I added my line of text /opt/mono/bin/mono /root/MySoft/UDPServer.exe "$@" to /etc/rc.d/rc.local

Now my Centos is frozen in loading screen... Is there any way to fix it back? :)

2 Answers 2

1

You probably forgot to put it in the background with &. Your system will "come back" when the process exits.

If you can't log in from the console, you can always log in via ssh from another machine.

2
  • The problem is, that when I wrote my application, I infinite looped it since it is a UDP server application :\ And the funny thing that it works -- catches my packets and places them to the database :)
    – Andrew
    Feb 27, 2013 at 4:22
  • 2
    OK, so ssh into the machine and fix it. Feb 27, 2013 at 4:22
1

This certainly "works" (for some value of "works"), but it isn't the right way to start a server. CentOS 6 is still using upstart in SysVinit compatility mode, and my Fedora 18 here runs systemd, so the following is from memory. Check your system, look around! Don't trust a colored square on the Internet...

Check /etc/init.d, you will find the scripts that start all services on the machine there. See if there is as simple (short, ls(1) helps) script for handling a network service, copy that to /etc/init.d/yourservice, adjust the precedences (want to start latest and stop earliest), the runlevels in which the service is to be active, and the description in the header (the commented section at the beginning); read, understand, and modify to handle your service. Then use chkconfig(8) to activate it and check if it is correctly configured, and try starting/stopping/restarting it (service start yourservice, etc).

Check the documentation on startup/shutdown, this is a more detailed discussion of creating a new service from scratch, while you'll find a simple template here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .