[CentOS] doing something before everything else

Andrew Holway andrew.holway at gmail.com
Sat Jul 22 15:30:52 UTC 2017


Ok, great I have an rc-local working but now I have a problem that Jenkins
is starting up before / during the rc-local is running.

Jenkins is shipping with an init script. I want to put a
"Before=jenkins.service" in rc-local but Jenkins doesnt have a service
file....

How can I ensure that rc-local is running before the Jenkins init?

Thanks,

Andrew

On 22 July 2017 at 14:06, Jonathan Billings <billings at negate.org> wrote:

> On Jul 22, 2017, at 8:28 AM, Andrew Holway <andrew.holway at gmail.com>
> wrote:
> > I want to run a script before systemd starts doing stuff but I cant find
> > anything online about how that could happen. It seems /etc/rc.local is
> > depreciated now?
>
> You can’t run anything before systemd starts, since it is started by the
> kernel before the local filesystems have been mounted.
>
> /etc/rc.d/rc.local still runs, but it is a systemd service run as
> rc-local.service, contingent on /etc/rc.d/rc.local existing and being
> executable.
>
> Now, if you want to run something before systemd starts other services,
> you need to create your own systemd unit, and set up dependencies such that
> the service starts before those services.  For example, you’d put
> "Before=network-pre.target” in the [Unit] section if you wanted your
> service to start before the network was brought up.  For what it’s worth,
> rc-local.service has a dependency that actually starts it *after* the
> network service comes up, so it starts later in the startup anyway.
>
>
> --
> Jonathan Billings <billings at negate.org>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>



More information about the CentOS mailing list