Skip to content

Instantly share code, notes, and snippets.

@larruda
Created October 9, 2013 12:39
Show Gist options
  • Save larruda/6900615 to your computer and use it in GitHub Desktop.
Save larruda/6900615 to your computer and use it in GitHub Desktop.
Jenkins standalone (Winstone) init script.
#!/bin/sh
DESC="Jenkins CI Server"
NAME=jenkins
RUN_AS=jenkins
HTTP_PORT=8281
LOGFILE=/var/log/jenkins.log
COMMAND="nohup /usr/bin/java -Dsvnkit.http.sslProtocols=\"SSLv3\" -jar /home/jenkins/jenkins.war --httpPort=$HTTP_PORT > $LOGFILE 2>&1 &"
d_start() {
su $RUN_AS -s /bin/bash -c "$COMMAND"
}
d_stop() {
pkill -u $RUN_AS
}
case $1 in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "usage: $NAME {start|stop|restart}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment