#!/bin/bash
#
# run-bridgedb-staging
# -----------------
# This script is used to start a staging instance which has already been
# configured and installed.
#
# :authors: Isis <isis@torproject.org> 0xa3adb67a2cdb8b35
# :licence: This file is part of BridgeDB, please see the LICENSE file,
#           included with BridgeDB for more info.
# :copyright: (c) 2014-2015 The Tor Project, Inc.
#             (c) 2014-2015 Isis Lovecruft
#-------------------------------------------------------------------------------

. /srv/bridges.torproject.org/etc/environment-staging

. ${VIRTUALENV_ACTIVATE}
export PATH=${BIN_DIR}:${PATH}
export PYTHONPATH=${SITEPKG}:${PYTHONPATH}

printf "Starting BridgeDB staging server..."
bridgedb -r ${RUN_DIR} -c ${BRIDGEDB_CONFIG} < /dev/null >> ${BRIDGEDB_SERVER_LOGFILE} 2>&1 & disown

STATUS="$?"
if test "$STATUS" == "0" ; then printf "\t\t[OK]\n" ; else printf "\t\t[FAIL]\n" ; fi
exit $STATUS
