LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Centos 6.6 /etc/init.d/rc.local doesn't run the command after restart (https://www.linuxquestions.org/questions/linux-newbie-8/centos-6-6-etc-init-d-rc-local-doesnt-run-the-command-after-restart-4175529228/)

ASTRAPI 12-25-2014 01:46 PM

Centos 6.6 /etc/init.d/rc.local doesn't run the command after restart
 
Hi

I am using shinx and i have on instructions to execute a command after server restart from rc.local so i do this:

Code:

nano /etc/init.d/rc.local

end i add the command there save and exit:

Code:

/usr/local/bin/searchd --config /sphinxconfig/sphinx.conf
But when i restart is not running and it was fine on Centos 6.5 :(

Then i run it manualy from ssh and all are fine ....

Any ideas why?

Thanks

Keith Hedger 12-25-2014 06:18 PM

have you made /etc/init.d/rc.local executable?

ASTRAPI 12-25-2014 07:41 PM

no should i ? and how?

I thought that should be already made by the system.....

michaelk 12-25-2014 08:31 PM

You add the commands to be run in the /etc/rc.local file. The init.d script executes that file.

ASTRAPI 12-25-2014 08:41 PM

So why is not running and what can i do for it?

michaelk 12-25-2014 09:02 PM

In a nutshell scripts are actually run from the /etc/rcx.d directory where x is the run level. If you look in rc5.d you will see that S99local is a link to the /etc/rc.local. Add the desired commands to the /etc/rc.local.

ASTRAPI 12-25-2014 09:09 PM

So can i just add my command to /etc/rc.local and it will run after restart ?

michaelk 12-25-2014 09:10 PM

Yes

ASTRAPI 12-25-2014 09:31 PM

Thanks !!!

Domination 01-26-2015 09:40 PM

Quote:

Originally Posted by ASTRAPI (Post 5290551)
Thanks !!!

But it doesn't works right? because /etc/rc.local is a symbolic link of /etc/init.d/rc.local
I am having the same issue. I'm going to rebuild my vps with centos 7.0 and lean "systemd"

michaelk 01-27-2015 10:01 AM

Domination,
CentOS 6 does not have an /etc/init.d/rc.local. Different distributions / versions have different methods for running a rc.local script. Actually sphinx is in the CentOS repositories so if installed via yum it should be a service so no need for rc.local. Just set the service to start at boot.

Your issue may or may not be similar but without any details we can not help.


All times are GMT -5. The time now is 04:31 PM.