LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-25-2014, 01:46 PM   #1
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Rep: Reputation: 16
Question 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
 
Old 12-25-2014, 06:18 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,398

Rep: Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603
have you made /etc/init.d/rc.local executable?
 
Old 12-25-2014, 07:41 PM   #3
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Original Poster
Rep: Reputation: 16
no should i ? and how?

I thought that should be already made by the system.....
 
Old 12-25-2014, 08:31 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,812

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
You add the commands to be run in the /etc/rc.local file. The init.d script executes that file.
 
Old 12-25-2014, 08:41 PM   #5
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Original Poster
Rep: Reputation: 16
So why is not running and what can i do for it?
 
Old 12-25-2014, 09:02 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,812

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
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.
 
Old 12-25-2014, 09:09 PM   #7
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Original Poster
Rep: Reputation: 16
So can i just add my command to /etc/rc.local and it will run after restart ?
 
Old 12-25-2014, 09:10 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,812

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
Yes
 
Old 12-25-2014, 09:31 PM   #9
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Original Poster
Rep: Reputation: 16
Thanks !!!
 
Old 01-26-2015, 09:40 PM   #10
Domination
LQ Newbie
 
Registered: Apr 2013
Posts: 2

Rep: Reputation: Disabled
Thumbs down

Quote:
Originally Posted by ASTRAPI View Post
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"
 
Old 01-27-2015, 10:01 AM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,812

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Restart FreeRadius from PHP Script (Run command as another user) buee Linux - Software 0 06-01-2012 11:39 AM
CentOS - run local profile at login RobertSubnet Linux - Newbie 12 12-15-2009 06:31 PM
halevt run as init script doesn't mount for users nemesis9 Linux - Desktop 1 11-05-2009 07:38 AM
rc.local doesn't run in Hardy rignes Ubuntu 3 05-07-2008 08:48 PM
In FC6 network interface doesn't come up if 'service network restart' command is run rajat Linux - Networking 2 05-02-2007 11:53 PM


All times are GMT -5. The time now is 05:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration