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

Re: /etc/rc.local and systemd



On Sunday 24 August 2014 11:45:40 Stephen Powell wrote:
> Hello, list.
> 
> I just thought I'd pass along something that I recently discovered.
> When using sysvinit as the init system, if the file /etc/rc.local
> exists and is executable, it will be invoked at the tail end of the
> boot process.  But under systemd, this file is not executed during
> boot.  Not by default anyway.  Here is how I enabled it.  (The
> following commands are executed as root.)
> 
> cd /lib/systemd/system/multi-user.target.wants
> ln -s ../rc-local.service rc-local.service
> 
> Now shutdown and reboot.  /etc/rc.local will get executed this time.
> If this is the "wrong" way to do it, or someone knows a better way,
> please let me know.

Interesting point. Mine seems to be working without this. I have the script 
/lib/systemd/system/rc-local.service

~$ cat /lib/systemd/system/rc-local.service
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
SysVStartPriority=99

This would seem to run the rc.local just fine on start. No stop, however ( but 
I can live without that).


Reply to: