Created
March 14, 2012 14:49
-
-
Save featheredtoast/2036988 to your computer and use it in GitHub Desktop.
Simple sample script to start/stop gerrit/jenkins/git daemon all in one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DESC="Gerrit and Jenkins CI Server" | |
NAME=gerritjenkins | |
PIDFILE=./$NAME.pid | |
STARTGITCOMMAND="git daemon --reuseaddr --export-all --base-path=gerrit/review/git" | |
STARTGERRITCOMMAND="java -jar gerrit/review/bin/gerrit.war daemon -d gerrit/review" | |
STARTJENKINSCOMMAND="java -jar jenkins/jenkins.war --httpPort=1234" | |
d_start(){ | |
$STARTGITCOMMAND & | |
echo $!>>$PIDFILE | |
$STARTGERRITCOMMAND & | |
echo $!>>$PIDFILE | |
$STARTJENKINSCOMMAND & | |
echo $!>>$PIDFILE | |
} | |
d_stop(){ | |
if [ -e $PIDFILE ] | |
then | |
while read line | |
do | |
kill $line | |
done <$PIDFILE | |
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 5 | |
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