Skip to content

Instantly share code, notes, and snippets.

@aliencode
Created May 7, 2014 06:22
Show Gist options
  • Save aliencode/68bc4d4e7ac0c413a44c to your computer and use it in GitHub Desktop.
Save aliencode/68bc4d4e7ac0c413a44c to your computer and use it in GitHub Desktop.
jenkins.sh 启动脚本
#!/bin/sh
DESC="Jenkins CI Server"
NAME=jenkins
PIDFILE=$NAME.pid
COMMAND="${PWD}/jdk1.7.0_21/bin/java -- -Xms128m -Xmx1024m -jar ${PWD}/jenkins.war"
d_start() {
export JENKINS_HOME=${PWD}/.jenkins
start-stop-daemon -b --start --quiet --pidfile $PIDFILE --make-pidfile --chuid docker --exec $COMMAND
}
d_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE
if [ -e $PIDFILE ]
then rm $PIDFILE
fi
}
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 2
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