You are not logged in.

#1 2012-08-14 12:43:11

ytj
Member
Registered: 2010-11-14
Posts: 22

Is that a good idea to put many things in /etc/rc.local?

Hello, all:

wiki told me that I could configure many files in /etc.
However, sorry if sounds stupid, I think this is not KISS.
I have to learn many different syntax to configure my computer.
I think put things in /etc/rc.local if possible is a good idea.

For example, We could configure things in this way:

[/etc/rc.conf] DAEMONS=(crond)
[/etc/fstab]   /dev/sda3 /home ext4 rw,relatime 0 1
[/etc/modules-load.d/vb.conf] vboxdrv

For a alternate, we could edit /etc/rc.local like this:

rc.d start crond
mount /dev/sda3 /home
modprobe vboxdrv

Now we do not need to learn any new syntax, everything is BASH!

Offline

#2 2012-08-14 14:08:54

brebs
Member
Registered: 2007-04-03
Posts: 3,414

Re: Is that a good idea to put many things in /etc/rc.local?

ytj wrote:

everything is BASH!

The future is systemd (so it seems), not BASH.

Offline

#3 2012-08-14 14:16:32

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,440
Website

Re: Is that a good idea to put many things in /etc/rc.local?

ytj wrote:

For example, We could configure things in this way:

...

For a alternate, we could edit /etc/rc.local like this:

..

I think there SHOULD be a problem with this but... I don't see a problem with this. yikes It works in your situation, but of course it wouldn't for everyone. For example, I assume if something on /home was needed during boot then you would need to load it earlier in /etc/fstab.

I'll probably end up doing it the first way just to be more "correct". I do already have some stuff in /etc/rc.local, such as setting up soft links to my disc drives.

brebs wrote:

The future is systemd (so it seems), not BASH.

Bash isn't going away any time soon. tongue Are you suggesting that /etc/rc.local will be going away?

Offline

#4 2012-08-14 15:48:25

ZekeSulastin
Member
Registered: 2010-09-20
Posts: 266

Re: Is that a good idea to put many things in /etc/rc.local?

drcouzelis wrote:

For example, I assume if something on /home was needed during boot then you would need to load it earlier in /etc/fstab.

That would be the main thing - rc.local is the very last thing run, so you're going to have to duplicate a lot of functionality if you're going to do more than mount a drive or two or start a single daemon.  Furthermore, as you noted, there are things that are simply expected to be there relatively early (such as fstab entries for important drives).

In the end, without a lot of infrastructure changes I think all you'll accomplish by sticking things in rc.local is adding yet another config file to check and, depending on what exactly you're doing, causing possible breakage hmm  It's not a bad thought though.

Offline

#5 2012-08-14 21:00:07

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Is that a good idea to put many things in /etc/rc.local?

You'll essentially be reimplementing rc.sysinit, just hardcoding everything. It will work, but I don't think it is a very good idea smile

Offline

#6 2012-08-14 21:17:11

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Is that a good idea to put many things in /etc/rc.local?

drcouzelis wrote:
brebs wrote:

The future is systemd (so it seems), not BASH.

Bash isn't going away any time soon. tongue Are you suggesting that /etc/rc.local will be going away?

That depends on the user.  Pure systemd setup:

==[ READY FOR INPUT ]== 

>>> cat /etc/rc.local
cat: /etc/rc.local: No such file or directory

Offline

#7 2012-08-14 21:34:21

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: Is that a good idea to put many things in /etc/rc.local?

Yeah, in systemd there is no more rc.local function.  That isn't to say you could not set it up to run it if you wanted to.  In fact I had it set up like that while I worked out how to set up the various unit files to set it the right way.  Essentially, you are supposed to write *.service files with systemd to run things that you would have otherwise put in rc.local in SysV.  It isn't hard once you get it all figured out, and it seems to do much better in that it handles all the dpendency stuff and parallelling better. 

So yes, rc.local is going away (if the move to systemd is the path taken, either by choice or eventually by default)

Offline

#8 2012-09-01 00:47:13

ConnorBehan
Trusted User (TU)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,356
Website

Re: Is that a good idea to put many things in /etc/rc.local?

Why not have a service file having

ExecStart=/etc/rc.local

come with the default units? In addition to being tedious, doing it Lennart's way on my system would be impossible because my rc.local does more than call isolated commands. It's a script with if statements... imagine that.

EDIT: Oh, I see there already is one that you can copy to enable.

Last edited by ConnorBehan (2012-09-01 01:28:06)


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

Board footer

Powered by FluxBB