Is /etc/rc.local called twice on boot?

Colin Law clanlaw at gmail.com
Wed Oct 27 08:14:55 UTC 2021


On Tue, 26 Oct 2021 at 18:17, Bo Berglund <bo.berglund at gmail.com> wrote:
>
> $ grep "rc.local" /var/log/syslog
> Oct 26 17:11:33 ubuntuserv systemd[1]: Starting LSB: Run /etc/rc.local if it
> exist...
> Oct 26 17:11:33 ubuntuserv systemd[1]: Started LSB: Run /etc/rc.local if it
> exist.
>
> Oct 26 17:11:46 ubuntuserv systemd[1]: Starting /etc/rc.local Compatibility...
> Oct 26 17:11:46 ubuntuserv systemd[1]: Started /etc/rc.local Compatibility.
>

As you can see it is being run twice.  The second one is the one that
should be there, which is the service rc-local.service, which is the
one that was made available when the automatic running of the script
was removed from Ubuntu.  I don't know where the first one is coming
from.  You should be able to stop the second one using
sudo systemctl disable rc-local

>...
> Question:
> ---------
> Is there a way to have grep output lines before and after a specific line hit?
> Say I will grep for "Starting /etc/rc.local" and want to see 10 lines before and
> after each hit?

I am sure that google or   man grep  would tell you that much quicker
than asking here.

Colin




More information about the ubuntu-users mailing list