Skip to content

Instantly share code, notes, and snippets.

@justengland
Last active July 23, 2016 23:51
Show Gist options
  • Save justengland/2386515cee27c9339f7c6bc098bfa318 to your computer and use it in GitHub Desktop.
Save justengland/2386515cee27c9339f7c6bc098bfa318 to your computer and use it in GitHub Desktop.
How to create a jenkins slave on a AWS linux box. Add the jenkins-slave to /etc/init.d/jenkins-slave
sudo chkconfig --add jenkins-slave --level 2345
sudo chkconfig jenkins-slav on
chkconfig | grep jenkins-slave
#!/bin/bash
# chkconfig: 2345 20 80
# description: Description comes here....
# Source function library.
. /etc/init.d/functions
start() {
echo "Start Jenkins Slave"
sudo -u jenkins-slave java -jar /etc/slave.jar -jnlpUrl http://jenkins.yourserver.com:8080/computer/aws-dev/slave-agent.jnlp -secret 12a33d4c7b684a0f422bf2130651a62c7d55f244fceee9317d2af6b772f2ebcb
}
stop() {
echo "Start Jenkins Slave"
killproc slave.jar
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
# code to check status of app comes here
# example: status program_name
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment