[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Trying to excute things on boot from /etc/rc.local

On Tue, Oct 01, 2019 at 09:28:05AM -0400, Gene Heskett wrote:
> On Tuesday 01 October 2019 08:57:26 Greg Wooledge wrote:
> > On Tue, Oct 01, 2019 at 12:58:22AM -0700, didier.gaumet@gmail.com 
> wrote:
> > > Is your system a Systemd one (by default in Debian), you have to
> > > enable rc.local:
> > > https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-wit
> > >h-systemd
> >
> > You don't have to enable the rc-local service in Debian.  It's already
> > enabled.  You can verify this with systemctl status rc-local.
> >
> > All you have to do are two steps:
> >
> > 1) Make sure /etc/rc.local begins with a valid shebang.
> > 2) Make sure /etc/rc.local has execute permissions.
> How long has this been true, Greg? I ask because thats the first place 
> I've tried to put things I needed running because it should be last in 
> the init sequence.  And I don't recall it ever working since LCNC 
> switched to wheezy from ubuntu 8 something. Perhaps this is why?

In wheezy-and-earlier, /etc/rc.local was supported by sysv-rc packages.

In jessie-and-later, /etc/rc.local is supported by the rc-local.service
in systemd.

Systems *installed* at jessie or earlier also got a default /etc/rc.local
file with a crapload of comments in it, a "#!/bin/sh -e" shebang which
is definitely not what I would recommend, and an "exit 0" at the end,
just to make sure newbies have multiple traps to fall in, like appending
a command to the end of the file and then wondering why it doesn't run.

Systems installed at stretch or later do not have a default /etc/rc.local
file, so one must be created by hand, following the two rules I gave.

Reply to: