[CentOS] How rc-local.service works?

Sun Mar 12 12:15:51 UTC 2017
Pete Biggs <pete at biggs.org.uk>

> Let me cite the service file here:
> [Unit]
> Description=/etc/rc.d/rc.local Compatibility
> ConditionFileIsExecutable=/etc/rc.d/rc.local
> After=network.target
> [Service]
> Type=forking
> ExecStart=/etc/rc.d/rc.local start
> TimeoutSec=0
> RemainAfterExit=yes
> I basically don't understand two things here:
> 1. What makes it run? Sure, when I make /etc/rc.d/rc.local executable,
> it runs. But for all I know, for it to run some other service must
> pull in it as a dependency. Am I wrong?

It will be run according to the status of the rc-local service - i.e.
what does 

  systemctl status rc-local

say. It's enabled by default, but it only runs if rc.local is
executable (as defined in the [Unit] section).

> 2. Why Type=forking?

Err, because it forks! (i.e. it can leave processes running after the
script has finished executing.)