Skip to end of metadata
Go to start of metadata

Linux startup script


daemonize is a very simple program that allows you to launch Jenkins (or any arbitrary program) as a daemon. For people without much Unix experience, this is recommended.


daemontools is another possibility. This is more complicated to set up and it doesn't really follow the normal Unix convention, but it offers daemon control (like start/stop), log capturing, as well as automatic restart when the service dies.

Shell script

        # Daemonize
        echo -n "Starting $SERVICE: "
        touch /var/run/
        chown jenkins:jenkins /var/run/
        su -s /bin/sh jenkins -c "
                cd /
                JENKINS_HOME=/var/lib/jenkins exec setsid /usr/bin/java   \
                        -jar /usr/share/java/jenkins/jenkins.war          \
                        $JENKINS_OPTS                                    \
                </dev/null >>/var/log/jenkins/console_log 2>&1 &
                echo \$! >/var/run/
                disown \$!

Adjust the above for your need – it is the part of my init scripts.

Java Service Wrapper

The The Java Service wrapper is a wrapper that works both on Unix and Windows. It requires some set up but when it is setup it can be used as any other unix service (like start/stop).

This example will install a Jenkins instance in /home/jenkins on a debian machine. The Jenkins configuration is stored in /home/jenkins/data. Jenkins will be running on port 8070 and as the jenkins user.

  1. Select and download a JSW package from the JSW wrapper download page.
  2. Unpack the package into the /home/jenkins path.
  3. Create /home/jenkins/tmp as the temporary directory for JSW.
  4. Download the jenkins.war file into /home/jenkins/lib.
    • If you have plugins that you would like to use, download them into /home/jenkins/data/plugins.
  5. Copy the /home/jenkins/src/conf/ to /home/jenkins/conf/wrapper.conf and change the below configuration properties in the file.
    # Set directly the time zone of the JVM, by setting this we do not rely on the time zone of the server.
    # Uncomment the following line if needed.
    wrapper.console.title=Jenkins Continuous build server
  6. Verify the wrapper configuration by starting Jenkins through /home/jenkins/bin/testwrapper console. Jenkins should be accessible through http://localhost:8070, if not check the console output for errors.
  7. Copy the /home/jenkins/src/bin/ to /etc/init.d/jenkins and change the below configuration properties in the file.
    APP_LONG_NAME="Jenkins Continuous build server"
  8. Verify installation by starting the daemon through /etc/init.d/jenkins start. Make sure that /etc/init.d/jenkins has the correct permissions; normally 755 is ok for this.

    Please feel free to add your suggestion here

Linux service - systemd

This is another way to start Jenkins as Linux service, also on system startup. I tested it on Fedora distribution, but it should work with other too. It needs some minimal experience with Linux superuser (sudo) and preferably basic Vi commands.

  1. Download jenkins.war file to any convenient destination, eg. /home/jenkins_user
  2. Create service file /etc/systemd/system/jenkins.service and paste following there:
    Description=Jenkins Daemon
    ExecStart=/usr/bin/java -jar /home/jenkins_user/jenkins.war
  3. Reload service manager: systemctl daemon-reload
  4. That's it! Now manage the service:
    systemctl start jenkins.service      # starts the service manually
    systemctl stop jenkins.service
    systemctl restart jenkins.service
    systemctl enable jenkins.service     # enable the service to start with system startup;
                                         # please note that it does not start the service instantly
    systemctl disable jenkins.service    # disable automatic start
  5. If anything goes wrong, use journalctl command (and scroll to bottom) to see any error messages.
  6. You may want to redirect or suppress Jenkins output, otherwise you can kill Journal log. Change jenkins.helper to eg. java -jar /home/jenkins_user/jenkins.war > /dev/null &

For further systemd configuration like auto restart, please refer to


Ubuntu Linux

Init Script for Jenkins Continuous Integration Engine on Ubuntu Linux

SuSE Linux

Init Script for Jenkins/Hudson Continuous Integration Engine on SuSE Linux


  1. I don't find the directories and files mentioned in step 5 for the java service wrapper.  What confusing about all of this is if you install via a deb.  The software ends up in /var/lib/jenkins.  Who/what creates the  /home/jenkins/ src/ and src/conf directories?

    1. I am using Fedora and i manually downloaded wrapper-linux-x86-32-3.5.7-pro.tar.gz and extracted them inside /home/jenkins - this directory was created by me manually. The extracted tar will contain the sys, conf, bin directories and also i created a user jenkins and had set /home/jenkins as it's home.  This works for me.

  2. Mistype in systemd service file: should be "[Install]" instead of "Install".