Skip to content

Instantly share code, notes, and snippets.

@featheredtoast
Created March 14, 2012 14:49
Show Gist options
  • Save featheredtoast/2036988 to your computer and use it in GitHub Desktop.
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
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