How can I install Jenkins as a systemd service

Article ID:360052728092
2 minute readKnowledge base


After migrating to an OS that uses systemd as service manager, you’ve noticed that the Init.d scripts you were using to start up your service are not working anymore.


You have to create a systemd service in order to start and stop your service. You can do it following Jenkins intermittently fails to restart on RHEL 7 and CentOS 7.

On that article, you should follow the instructions to migrate the Init.d script you have to a systemd service.

You can modify the values of the output systemctl with your values, here’s a more detailed explanation of the options:

  • jenkins.service (file you create under /etc/systemd/…​): it will define the name of the service you’re creating on systemd, if you create a file named cloudbeescore.service, you’ll be able to start the service running systemctl start cloudbeescore

  • Description: is a text that will appear as service’s description.

  • Wants: configures requirement dependencies on other units.

  • ExecStart: is the command that will be run by systemd when you run a systemctl start command (you may add the command you was running on your previous environment).

  • User: is the user that will start Jenkins (we suggest you not using root)

  • SuccessExitStatus: defines the exit status definitions that will be considered successful terminations.

  • TimeoutStopSec: as there are no ExecStop in the file generated by the script, it will make the service get SIGTERM on stop call and SIGKILL after the defined seconds.

  • RestartSec: configures the seconds to sleep before restarting a service.

  • Limit*: these properties configure the limits of this service, matching our Prepare CloudBees CI for Support recommendations.

  • WantedBy: sets the runlevel (using will set it to Multi-user)

Don’t forget enabling the service by running systemctl enable cloudbeescore. Otherwise, the service won’t start on server restarts.