CentOS stopped loading after I added something to /etc/rc.d/rc.local
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? :)
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.
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.