Re: rc-local.service and its future in systemd?

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

 



On Mon, Apr 24, 2023 at 01:20:09PM +0300, Aki Ketolainen wrote:
> > as Lennart already told you in the GitHub issue that "last" just doesn't
> > make sense in systemd, there is also no need to change the dependencies
> > global for everyone. Especially as there are systems out there which
> > doesn't have crond installed (because there are .timer).
> > 
> > Your best bet is really to change all your custom scripts from rc.local
> > into proper .service and instead of crond check out systemd.timer.
> > 
> > BR
> > Silvio
> 
> I tried to set After=systemd-update-utmp-runlevel.service but I got some
> cyclic dependency problem. Would you know how to do that?
> 
> Best regards,
> 
> Aki

If you'd still like to continue using /etc/rc.d/rc.local, and it would be
enough for it to be executed "after boot", IOW, after the default
runlevel at boot is reached, the following four commands might help you:

$ cat >/tmp/order-last.conf <<EOConf
[Unit]
After=default.target

[Service]
StandardOutput=journal+console
StandardError=journal+console
EOConf
$ mkdir -p /etc/systemd/system/rc-local.service.d/
$ mv /tmp/order-last.conf /etc/systemd/system/rc-local.service.d/
$ systemctl daemon-reload

Then, make sure `rc-local.service` is enabled.

default.target should be a symlink to another target, likely multi-user
or graphical.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux