LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 03:23 PM   #1
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

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, 10:32 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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-05-2016, 11:09 PM   #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, 07:43 AM   #4
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

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, 11:36 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

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

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

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, 07: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, 07:48 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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



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

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

All times are GMT -5. The time now is 08:40 AM.

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
Open Source Consulting | Domain Registration