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?
On Jul 22, 2017, at 8:28 AM, Andrew Holway andrew.holway@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@negate.org
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@negate.org wrote:
On Jul 22, 2017, at 8:28 AM, Andrew Holway andrew.holway@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@negate.org
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Am 22.07.2017 um 17:30 schrieb Andrew Holway:
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
Andrew,
please stop top-posting and not stripping quotes.
What exactly do you intend to achieve regarding the start of Jenkins on your CentOS 7 system?
While I am really surprised that the Jenkins team hasn't made their Jenkins RPM packages systemd aware but still providing a sysv init script, you probably try to do something which should be solved in a different way.
Alexander
On Jul 22, 2017, at 12:25 PM, Alexander Dalloz ad+lists@uni-x.org wrote:
While I am really surprised that the Jenkins team hasn't made their Jenkins RPM packages systemd aware but still providing a sysv init script, you probably try to do something which should be solved in a different way.
There’s always:
https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+as+a+Unix+daemon https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+as+a+Unix+daemon
scroll down to the systemd section.
-- Jonathan Billings billings@negate.org
Am 22.07.2017 um 20:47 schrieb Jonathan Billings:
On Jul 22, 2017, at 12:25 PM, Alexander Dalloz ad+lists@uni-x.org wrote:
While I am really surprised that the Jenkins team hasn't made their Jenkins RPM packages systemd aware but still providing a sysv init script, you probably try to do something which should be solved in a different way.
There’s always:
https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+as+a+Unix+daemon https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+as+a+Unix+daemon
scroll down to the systemd section.
-- Jonathan Billings billings@negate.org
Ok, thanks for that hint. I only had a look into the RPM of the latest Jenkins release and that's not shipping with a service file. Well, you can follow the wiki and place the jenkins.service file into /etc/systemd/system/. Probably the project does not care to build packages for the different major releases shipping with different init systems.
Still curious what Andrew tries to achieve.
Alexander