Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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? :)

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
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 '13 at 4:22
1  
OK, so ssh into the machine and fix it. –  Michael Hampton Feb 27 '13 at 4:22
    
Michael, thank you! I was able to solve it! –  Andrew Feb 27 '13 at 5:25
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.