Parent: [017716] (diff)

Download this file

start_allura    69 lines (59 with data), 2.1 kB

#!/bin/bash

#       Licensed to the Apache Software Foundation (ASF) under one
#       or more contributor license agreements.  See the NOTICE file
#       distributed with this work for additional information
#       regarding copyright ownership.  The ASF licenses this file
#       to you under the Apache License, Version 2.0 (the
#       "License"); you may not use this file except in compliance
#       with the License.  You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#       Unless required by applicable law or agreed to in writing,
#       software distributed under the License is distributed on an
#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#       KIND, either express or implied.  See the License for the
#       specific language governing permissions and limitations
#       under the License.

# Starts Allura platform services

# Activate Allura virtualenv
. /home/vagrant/env-allura/bin/activate

# Create log dir
if [ ! -d /var/log/allura ]
then
    sudo mkdir -p /var/log/allura
    sudo chown vagrant:vagrant /var/log/allura
fi
echo "Logs are in /var/log/allura"

# Start solr
if pgrep -f start.jar >/dev/null
then
    echo "Solr is running."
else
    echo "Starting Solr..."
    cd /home/vagrant/src/solr-4.2.1/example
    nohup java -jar start.jar >/var/log/allura/solr.log 2>&1 &
fi

cd /home/vagrant/src/allura/Allura

# Start taskd
if pgrep -f "paster taskd" >/dev/null
then
    echo "Taskd is running."
else
    echo "Starting taskd..."
    nohup paster taskd development.ini >/var/log/allura/taskd.log 2>&1 &
fi

# Run setup-app
if [ ! -f /var/lib/mongodb/allura.0 ]
then
    echo "Initializing database..."
    paster setup-app development.ini >/var/log/allura/setup-app.log 2>&1 || echo "Error, see /var/log/allura/setup-app.log"
fi

# Start the web server
if pgrep -f "paster serve" >/dev/null
then
    echo "Web server is running."
else
    echo "Starting web server (port 8080 by default) ..."
    nohup paster serve --reload development.ini >/var/log/allura/allura.log 2>&1 &
fi