L-o-n-g delay for rc.local in systemd on Ubuntu.

Tom Buskey tom at buskey.name
Tue Aug 8 11:01:33 EDT 2017


If your system is using systemd, don't use rc.local.  rc.local is not
deterministic in systemd.  I've had to move everything out of rc.local and
learn systemd to get reliable starting.

I created something like this (run_on_boot.service)

[Unit]
Description=Run at startup
After=network.target network-online.target sshd.service

[Service]
Type=simple
WorkingDirectory=/tmp
ExecStart=/usr/local/bin/run_on_boot

[Install]
WantedBy=multi-user.target


Copy run_on_boot.service to /etc/systemd/system
systemctl enable run_on_boot

The above will run the file in ExecStart after the targets, etc on next
boot.  Systemd will do a topological sort on the dependencies to start
things in the right order and run in parallel if it can.

We used to throw things into rc.local or create a script, tack S99 on the
name and put it in /etc/rc3.d. The systemd group would eliminate rc.local
if they could, so it's barely supported.  It gets started at some random
time, not after everything else.

On Tue, Aug 8, 2017 at 10:28 AM, Ken D'Ambrosio <ken at jots.org> wrote:

> Hey, all.  I've got some stuff in my rc.local, and it takes *forever* to
> execute -- three+ minutes.  (Note that the machine -- a virtual one --
> is up in something like 20 seconds.)  I *need* this stuff, which is
> lightweight in the extreme, to execute much more quickly than that.
> Anyone have any ideas on how to make that happen?
>
> Thanks,
>
> -Ken
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/pipermail/gnhlug-discuss/attachments/20170808/7c907bbb/attachment.html 


More information about the gnhlug-discuss mailing list