LinuxQuestions.org
Visit Jeremy's Blog.
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 02-05-2016, 04:23 PM   #1
bmxakias
Member
 
Registered: Jan 2016
Posts: 45

Rep: Reputation: Disabled
Question Centos 7.2 /etc/rc.local replaced?


Hi

I was use on Centos 6.x this:

Code:
nano /etc/rc.local
and i add:

Code:
rm -f /var/sphinx/*.spl
/usr/local/bin/searchd --config /sphinxconfig/sphinx.conf
Now on Centos 7.2 this file is not used or it doesn't do exactly what was do or is not recommended for such edits.....

Can you please help me with this as i do not know what to edit or how to fix it now ?

Thank you
 
Old 02-05-2016, 11:32 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,713

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
Is the file executable?

Normally it would also have a "#!/usr/bin/bash" as the first line.

I believe it is only used if it is executable.
 
Old 02-06-2016, 12:09 AM   #3
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
With systemd you need to enable the rc-local.service
Code:
systemctl enable rc-local.service
 
Old 02-06-2016, 08:43 AM   #4
bmxakias
Member
 
Registered: Jan 2016
Posts: 45

Original Poster
Rep: Reputation: Disabled
yes it has on the first line the:

Code:
#!/bin/bash
No it is not executable... Ok i did it now....

Do i have to use also this?

Code:
systemctl enable rc-local.service
 
Old 02-06-2016, 12:36 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,713

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
yes (though you can drop the ".service" part.

You can test it without rebooting by "systemctl start rc-local"
 
Old 02-06-2016, 08:34 PM   #6
bmxakias
Member
 
Registered: Jan 2016
Posts: 45

Original Poster
Rep: Reputation: Disabled
This is what i got

Code:
[root@server ~]# chmod +x /etc/rc.d/rc.local
[root@server ~]# systemctl enable rc-local
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
 
Old 02-06-2016, 08:43 PM   #7
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Try putting your rc.local file in /etc/rc.d/rc.local, make sure it's marked as executable.

I haven't used rc.local in a couple years, apparently you no longer need to enable the rc-local.service, it's now a static unit.
 
Old 02-06-2016, 08:48 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,713

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
I think you can ignore that (I get it too).

Service units that do have an install section also have a "WantedBy=..." entry. rc.local doesn't have any services that depend on it.
 
  


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
/etc/rc.local in CentOS 7 dipanjan CentOS 13 08-28-2014 06:14 PM
Local repository on centos 5.4 callmanager Linux - Server 11 09-11-2012 06:46 AM
Replaced 2 IDE drives; CentOS only sees 1 JMCraig Linux - Hardware 7 01-08-2010 05:23 PM
Remotely replaced sshd_config, CentOS 5.3/SSH 4.3p2-36el5_4.2 OffbeatAdam Linux - Security 14 11-25-2009 12:39 PM
CentOS 4.1: LILO replaced GRUB and... SupaDucta Linux - General 3 07-04-2005 01:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:00 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