power_settings_new

how do I install Jenkins as startup program in Ubuntu?

by
asked
+1 vote
75 views
We are trying to install Jenkins into Ubuntu. But we are facing chellange with default jenkins installation that it forces us to create users. It will not allow us to install jenkins without setting up user account. So we have plans to use war file, jenkins.war, file with ubuntu. I need procedure with script to set Jenkins as startup program in Ubuntu machine.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

3 Answers

answered by (171 points)
0 votes

Add commands to /etc/rc.local

$sudo vim /etc/rc.local

with content like the following.

# This script is executed at the end of each multiuser runlevel
java -jar /path/to/jenkins.war &   # Added by me
exit 0
answered by (171 points)
0 votes

Add an Upstart job.

Create /etc/init/myjob.conf

$sudo vim /etc/init/myjob.conf

with content like the following

description     "my job"
start on startup
task
java -jar /path/to/jenkins.war &
answered by
0 votes

Also you can try add an initscript.

Create a new script in /etc/init.d/myscript.

sudo vim /etc/init.d/myscript

(Obviously it doesn't have to be called "myscript".) In this script, do whatever you want to do. Perhaps just run the script you mentioned.

#!/bin/sh
java -jar /path/to/jenkins.war &

Make it executable.

chmod ugo+x /etc/init.d/myscript

Configure the init system to run this script at startup.

update-rc.d myscript defaults
add
...