2010-04-03 07:10:49 +08:00
#!/bin/bash
2009-11-04 08:33:36 +08:00
#
# Copyright (c) 2008-2009 by BigBlueButton
#
# This file is part of BigBlueButton - http://www.bigbluebutton.org
#
# BigBlueButton is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
2009-12-12 05:20:34 +08:00
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
2009-11-04 08:33:36 +08:00
#
# Author(s):
# Fred Dixon <ffdixon@bigbluebutton.org>
#
# Changelog:
2009-12-12 05:20:34 +08:00
# 2009-10-18 FFD Inital Version
# 2009-11-05 FFD Updated for 0.62
# 2009-12-09 FFD Updated for 0.63
# 2009-12-11 FFD Added ability to swtich conference servers
2009-12-13 01:56:14 +08:00
# 2009-12-12 FFD Added cleaning and watching of log files
2010-01-06 07:57:22 +08:00
# 2010-01-05 FFD Added zipping of log files
2010-01-19 10:20:22 +08:00
# 2010-01-18 FFD Added resetting of environment back to using packages
2010-03-03 12:55:48 +08:00
# 2010-03-02 JRT Added trunk checkout options / fixed bbb-apps instructions
2010-04-03 01:41:51 +08:00
# 2010-04-02 FFD Updated for 0.64
2010-06-22 01:45:45 +08:00
# 2010-06-21 SEB Cleaned up some code / Updated for 0.70
2010-07-01 03:50:31 +08:00
# 2010-06-25 SEB Added ability to change the security salt
2010-07-01 03:57:39 +08:00
# 2010-06-30 SEB Added some extra errorchecking
2010-07-07 02:48:33 +08:00
# 2010-07-06 SEB Added more errorchecking and report messages
2010-10-04 11:27:23 +08:00
# 2010-09-15 FFD Updates for 0.71-dev
2009-11-04 08:33:36 +08:00
2010-04-03 01:41:51 +08:00
#set -x
2009-11-04 08:33:36 +08:00
2010-09-20 09:47:17 +08:00
#
# Setup some global variables
#
VOICE_CONFERENCE=$(cat /usr/share/red5/webapps/bigbluebutton/WEB-INF/red5-web.xml | grep -v '<!--' | grep bbb-voice-freeswitch.xml | sed -n '/import /{s/.*resource="//;s/".*//;p}')
IP=$(ifconfig | grep -m 1 'inet addr:' | cut -d: -f2 | awk '{print $1}')
2010-03-09 23:32:20 +08:00
GENTOO=$(uname -r | grep gentoo | cut -d- -f2);
TOMCAT=""
2010-04-03 01:37:06 +08:00
2010-09-20 09:47:17 +08:00
#
# Helper functions
#
2010-02-09 05:22:16 +08:00
get_platform() {
2010-02-12 00:32:09 +08:00
if [ -f /etc/lsb-release ]; then
if grep -q Ubuntu /etc/lsb-release; then
echo "ubuntu"
fi
2010-03-09 23:32:20 +08:00
elif [ ${GENTOO} ]; then
echo "gentoo"
2010-02-09 05:22:16 +08:00
else
2010-02-12 00:32:09 +08:00
echo "redhat"
2010-02-09 05:22:16 +08:00
fi
}
2010-04-03 01:37:06 +08:00
2010-02-09 05:22:16 +08:00
PLATFORM=$(get_platform)
is_redhat() {
if [ "$PLATFORM" == "redhat" ]; then
2010-07-01 03:50:31 +08:00
echo "yes"
2010-02-09 05:22:16 +08:00
fi
}
is_ubuntu() {
if [ "$PLATFORM" == "ubuntu" ]; then
echo "yes"
fi
}
2010-03-09 23:32:20 +08:00
is_gentoo() {
if [ "$PLATFORM" == "gentoo" ]; then
echo "yes"
fi
}
2010-02-09 05:22:16 +08:00
is_vm() {
if [ -f /home/firstuser/.profile ]; then
echo $(cat /home/firstuser/.profile | grep BigBlueButton)
fi
}
2010-02-12 00:32:09 +08:00
if [ "$(is_redhat)" ]; then
2010-03-09 23:32:20 +08:00
TOMCAT="tomcat6"
2010-07-07 22:57:20 +08:00
RED5_DIR="/usr/share/red5"
2010-07-07 22:58:28 +08:00
ACTIVEMQ_DIR="/usr/share/activemq"
2010-03-09 23:32:20 +08:00
TOMCAT6_LOGS="/var/log/${TOMCAT}"
elif [ "$(is_gentoo)" ]; then
TOMCAT="tomcat-6"
2010-07-07 22:57:20 +08:00
RED5_DIR="/usr/share/red5"
2010-07-07 22:58:28 +08:00
ACTIVEMQ_DIR="/usr/share/activemq"
2010-03-09 23:32:20 +08:00
TOMCAT6_LOGS="/var/lib/${TOMCAT}/logs"
2010-02-09 05:22:16 +08:00
else
2010-02-12 00:32:09 +08:00
if [ "$(is_ubuntu)" ]; then
2010-03-09 23:32:20 +08:00
TOMCAT="tomcat6"
2010-07-07 22:57:20 +08:00
RED5_DIR="/usr/share/red5"
2010-07-07 22:58:28 +08:00
ACTIVEMQ_DIR="/usr/share/activemq"
2010-03-09 23:32:20 +08:00
TOMCAT6_LOGS="/var/lib/${TOMCAT}/logs"
2010-02-09 05:22:16 +08:00
fi
fi
2010-04-03 01:37:06 +08:00
2009-11-06 04:57:56 +08:00
print_header() {
if [ ! $HEADER ]; then
2010-02-09 05:22:16 +08:00
echo
2010-07-16 00:55:42 +08:00
echo "** Potential problems described below **"
2009-11-06 04:57:56 +08:00
HEADER=1
fi
}
2009-11-04 08:33:36 +08:00
check_root() {
if [ $EUID == 0 ]; then
2010-03-03 12:55:48 +08:00
echo "This operation should not be run as root."
2009-11-04 08:33:36 +08:00
echo
echo "If this operation needs to execute an operation as root, you'll be asked for"
echo "your password to execute the operation using sudo."
exit 1
fi
}
2009-12-12 05:20:34 +08:00
need_root() {
if [ $EUID != 0 ]; then
2009-12-13 22:34:01 +08:00
echo "Need to be root to run this option"
2009-12-12 05:20:34 +08:00
exit 1
fi
}
2009-12-10 06:49:49 +08:00
usage() {
2010-09-26 01:25:17 +08:00
echo "BigBlueButton Configuration Utility - Version 0.71-dev1"
2010-07-05 22:39:13 +08:00
echo "http://code.google.com/p/bigbluebutton/wiki/BBBConf"
2010-04-03 01:37:06 +08:00
echo
echo "$0 [options]"
echo
echo "Configuration:"
echo " --version Display BigBlueButton version (packages)"
echo " --setip <host> Set IP/hostname for BigBlueButton"
2010-09-20 09:47:17 +08:00
echo " --conference [konference|meetme|freeswitch]"
echo " Switch conference module"
2010-07-08 04:17:55 +08:00
echo " --salt <salt> Change the security salt in bigbluebutton.properties"
2010-04-03 01:37:06 +08:00
echo
echo "Monitoring:"
2010-07-08 04:17:55 +08:00
echo " --check <verbose> Check configuration files and processes for problems"
2010-04-03 01:37:06 +08:00
echo " --debug Scan the log files for error messages"
2010-04-03 03:25:02 +08:00
echo " --watch Scan the log files for error messages every 2 seconds"
2010-04-03 01:37:06 +08:00
echo
echo "Administration":
echo " --restart Restart BigBueButton"
echo " --clean Clear all the log files and restart BigBlueButton"
echo " --zip Zip up log files for reporting an error"
echo
if [ "$(is_vm)" ]; then
echo "Development:"
echo " --setup-samba Setup samba share for development (VM only)"
2010-07-03 23:36:10 +08:00
echo " --checkout <repo> Checkout from github or passed in repository"
2010-07-01 03:50:31 +08:00
echo " --setup-dev [client|web|apps] Setup development environment "
2010-04-03 01:37:06 +08:00
echo " --reset-dev Reset environment back to using packages"
fi
echo
2009-11-04 08:33:36 +08:00
}
# utility function to make a copy of the conf file
check_and_backup () {
# can we write to the configuration file?
if [ ! -w $1 ]; then
echo "Cannot write to $1!"
exit 1
fi
# let's see if we need a copy
if [ "$TO_BACKUP" = "Y" ]; then
cp $1 $1.bak
TO_BACKUP="N"
fi
}
# 3 paramenter: the file, the variable name, the new value
change_var_value () {
check_and_backup $1
sed -i "s<^[[:blank:]#]*\(${2}\).*<\1=\"${3}\"<" $1
}
2010-08-27 02:34:03 +08:00
change_var_ip () {
check_and_backup $1
sed -i "s<^[[:blank:]#]*\(${2}\).*<\1=${3}<" $1
}
2010-09-20 09:47:17 +08:00
2010-07-01 03:50:31 +08:00
# same as change_var_value but without quotes
change_var_salt() {
check_and_backup $1
sed -i "s<^[[:blank:]#]*\(${2}\).*<\1="${3}"<" $1
}
2010-09-20 09:47:17 +08:00
2009-11-04 08:33:36 +08:00
# comment lines matching $2 ($1 is the file)
comment () {
check_and_backup $1
sed -i "s<^[[:blank:]]*\(${2}.*\)<#\1<" $1
}
2010-09-20 09:47:17 +08:00
2009-11-04 08:33:36 +08:00
# comment lines matching $2 ($1 is the file)
uncomment () {
check_and_backup $1
sed -i "s<^[#[:blank:]]*\(${2}.*\)<\1<" $1
}
2010-03-25 21:55:39 +08:00
stop_bigbluebutton () {
/etc/init.d/red5 stop
/etc/init.d/${TOMCAT} stop
/etc/init.d/nginx stop
2010-08-23 21:49:54 +08:00
if [ -a /opt/freeswitch/run/freeswitch.pid ]; then
/etc/init.d/freeswitch stop
fi
if [ -a /var/run/asterisk/asterisk.pid ]; then
/etc/init.d/asterisk stop
fi
/etc/init.d/activemq stop
2010-07-09 01:16:26 +08:00
/etc/init.d/bbb-openoffice-headless stop
2010-03-25 21:55:39 +08:00
}
2010-09-16 00:03:31 +08:00
2010-03-25 21:55:39 +08:00
start_bigbluebutton () {
2010-09-20 09:47:17 +08:00
if [ "$VOICE_CONFERENCE" == "bbb-voice-freeswitch.xml" ]; then
2010-09-16 04:21:55 +08:00
echo "Starting Freeswitch"
2010-08-23 21:49:54 +08:00
/etc/init.d/freeswitch start
2010-09-20 09:47:17 +08:00
else
2010-09-16 04:21:55 +08:00
echo "Starting Asterisk"
2010-08-23 21:49:54 +08:00
/etc/init.d/asterisk start
fi
2010-03-25 21:55:39 +08:00
/etc/init.d/activemq start
2010-09-20 09:47:17 +08:00
/etc/init.d/bbb-openoffice-headless start
2010-03-25 21:55:39 +08:00
sleep 5
/etc/init.d/nginx start
/etc/init.d/red5 start
/etc/init.d/${TOMCAT} start
2010-07-16 00:51:14 +08:00
sleep 5
2010-03-25 21:55:39 +08:00
}
display_bigbluebutton_status () {
/etc/init.d/activemq status
/etc/init.d/nginx status
/etc/init.d/red5 status
/etc/init.d/${TOMCAT} status
}
2010-08-31 21:48:54 +08:00
if [ $# -eq 0 ]; then
usage
exit 1
fi
2009-11-04 08:33:36 +08:00
# Parse the parameters
while [ $# -gt 0 ]; do
2009-11-06 02:33:28 +08:00
if [ "$1" = "-check" -o "$1" = "--check" -o "$1" = "-c" ]; then
2009-11-04 08:33:36 +08:00
CHECK=1
2010-07-08 04:17:55 +08:00
shift;shift
2009-11-05 12:08:22 +08:00
continue
2009-11-04 08:33:36 +08:00
fi
2009-11-04 09:18:58 +08:00
if [ "$1" = "--setup-samba" -o "$1" = "-setup-samba" ]; then
SAMBA=1
2009-11-06 02:33:28 +08:00
shift
continue
fi
if [ "$1" = "--version" -o "$1" = "-version" -o "$1" = "-v" ]; then
VERSION=1
shift
2009-11-04 09:18:58 +08:00
continue
fi
2009-12-10 06:49:49 +08:00
if [ "$1" = "--debug" -o "$1" = "-debug" -o "$1" = "-d" ]; then
DEBUG=1
shift
continue
fi
2010-01-16 22:28:53 +08:00
if [ "$1" = "--clean" -o "$1" = "-clean" ]; then
2009-12-13 01:56:14 +08:00
CLEAN=1
shift
continue
fi
if [ "$1" = "--watch" -o "$1" = "-watch" -o "$1" = "-w" ]; then
WATCH=1
shift
continue
fi
2009-12-13 22:34:01 +08:00
if [ "$1" = "--network" -o "$1" = "-network" -o "$1" = "-n" ]; then
NETWORK=1
shift
continue
fi
2010-01-06 07:57:22 +08:00
if [ "$1" = "--zip" -o "$1" = "-zip" -o "$1" = "-z" ]; then
ZIP=1
shift
continue
fi
2010-01-19 10:20:22 +08:00
if [ "$1" = "--reset-dev" -o "$1" = "-reset-dev" -o "$1" = "-r" ]; then
RESET_DEV=1
shift
continue
fi
2010-03-25 21:55:39 +08:00
if [ "$1" = "--restart" -o "$1" = "-restart" ]; then
RESTART=1
shift
continue
fi
2010-07-01 03:50:31 +08:00
if [ "$1" = "--checkout" -o "$1" = "-checkout" ]; then
echo "# Request to checkout BigBlueButton"
2010-07-03 23:36:10 +08:00
if [ $# -lt 2 ]; then
CHECKOUT="git://github.com/bigbluebutton/bigbluebutton.git"
else
CHECKOUT="${2}"
fi
2010-07-01 03:50:31 +08:00
shift; shift
continue
2010-08-31 21:48:54 +08:00
fi
2010-07-01 03:50:31 +08:00
2009-11-04 08:33:36 +08:00
#
# all other parameters requires at least 1 argument
#
2010-08-31 02:28:27 +08:00
#if [ $# -lt 2 ]; then
#usage
# exit 1
#fi
2009-11-04 08:33:36 +08:00
if [ "$1" = "-setip" -o "$1" = "--setip" ]; then
2009-11-05 12:08:22 +08:00
HOST="${2}"
2010-09-20 09:47:17 +08:00
if [ -z "$HOST" ]; then
echo "HOST IP=$IP"
2010-08-31 02:28:27 +08:00
#echo "PORT=`echo ${2}|cut -d: -f2`"
fi
2010-03-09 23:32:20 +08:00
if echo $HOST|grep -q ":"; then
HOST=`echo ${2}|cut -d: -f1`
PORT=`echo ${2}|cut -d: -f2`
fi
2009-11-04 08:33:36 +08:00
shift; shift
continue
fi
2010-07-01 03:50:31 +08:00
if [ "$1" = "--setup-dev" -o "$1" = "-setup-dev" ]; then
SETUPDEV="${2}"
2010-08-31 02:28:27 +08:00
if test -z "${2}"; then
usage;
fi
2010-07-01 03:50:31 +08:00
shift; shift
continue
fi
2010-07-01 03:28:54 +08:00
if [ "$1" = "--conference" -o "$1" = "-conference" ]; then
CONFERENCE="${2}"
2010-09-20 09:47:17 +08:00
confapp=$(cat /usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties | grep 'asterisk.application' | sed s/.*=//g);
if [ -z "$CONFERENCE" ] ; then
2010-08-31 02:28:27 +08:00
if [ $confapp == "meetme" ]; then
2010-09-20 09:47:17 +08:00
echo "Current conference application is $confapp"
elif [ $confapp == "konference" ] && [ $VOICE_CONFERENCE == "bbb-voice-asterisk.xml" ]; then
echo "Current conference application is $confapp"
elif [ $VOICE_CONFERENCE == "bbb-voice-freeswitch.xml" ]; then
echo "Current conference application is freeswitch"
2010-08-31 02:28:27 +08:00
fi
2010-09-20 09:47:17 +08:00
exit 0
2010-08-31 02:28:27 +08:00
fi
2010-06-26 00:11:36 +08:00
shift; shift
continue
2010-07-01 03:28:54 +08:00
fi
2010-07-01 03:50:31 +08:00
2010-08-10 03:39:35 +08:00
if [ "$1" = "--salt" -o "$1" = "-salt" -o "$1" = "--set-salt" ]; then
2010-07-01 03:50:31 +08:00
SALT="${2}"
2010-08-31 02:28:27 +08:00
CSALT=`cat /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | grep securitySalt | cut -d= -f2`;
2010-09-20 09:47:17 +08:00
if [ -z "$SALT" ]; then
echo "Current Salt retrieved from bigbluebutton.properties: $CSALT"
2010-08-31 02:28:27 +08:00
fi
2010-07-01 03:50:31 +08:00
shift; shift
continue
fi
2009-12-12 05:20:34 +08:00
2009-11-04 08:33:36 +08:00
usage
exit 1
done
#
# Version
#
if [ $VERSION ]; then
2010-02-12 00:32:09 +08:00
if [ "$(is_redhat)" ]; then
2010-02-09 05:22:16 +08:00
echo "$(yum list installed | grep bbb-conf)"
else
2010-02-12 00:32:09 +08:00
if [ "$(is_ubuntu)" ]; then
2010-02-09 05:22:16 +08:00
echo
dpkg -l | grep bbb
fi
fi
2009-11-04 08:33:36 +08:00
exit 0
fi
2009-11-04 09:18:58 +08:00
#
2010-09-20 09:47:17 +08:00
# Set Security Salt
# - XXX
2009-11-04 09:18:58 +08:00
#
2010-07-01 03:50:31 +08:00
if [ $SALT ]; then
need_root
# echo $SALT;
change_var_salt /var/lib/$TOMCAT/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties beans.dynamicConferenceService.securitySalt $SALT
2010-09-20 09:47:17 +08:00
echo "Changed the security salt to $SALT"
2010-07-01 03:50:31 +08:00
fi
2010-09-20 09:47:17 +08:00
#
# Setup samba
#
2009-11-04 09:18:58 +08:00
if [ $SAMBA ]; then
2010-01-24 12:00:01 +08:00
check_root
2009-11-04 09:18:58 +08:00
#
# Instal Samba
#
if ! dpkg-query -s samba > /dev/null 2>&1; then
2009-11-07 00:15:45 +08:00
sudo apt-get install -y --force-yes samba ant
2009-11-04 09:18:58 +08:00
fi
#
# Add a share to samba
#
if ! grep -q $USER /etc/samba/smb.conf; then
echo ";
; BigBlueButton: Share the development directory
[$USER]
comment = BigBlueButton Development share
path = /home/$USER
browseable = yes
read only = no
create mask = 0755
directory mask = 0775
guest ok = yes
force user = $USER
" | sudo tee -a /etc/samba/smb.conf > /dev/null 2>&1
2010-07-13 21:20:22 +08:00
sudo /etc/init.d/smbd restart
2009-11-04 09:18:58 +08:00
echo "
You can now access your development folder through:
2010-01-24 12:00:01 +08:00
\\\\${IP}\\$USER
2009-11-04 09:18:58 +08:00
If you are running a development environment on Windows (such as using Eclipse or FlexBuilder),
you can map the above path to a drive letter.
"
else
echo "Already detected a definition for $USER in /etc/samba/smb.conf"
echo "No changes were made to /etc/samba/smb.conf"
fi
fi
2009-11-04 08:33:36 +08:00
#
# Setup the development environemnt.
#
2010-07-01 03:50:31 +08:00
if [ $CHECKOUT ]; then
2009-11-04 08:33:36 +08:00
check_root
2010-01-06 07:57:22 +08:00
# This is a step towards setting up a development environment on a non-BigBlueButton VM
2010-07-01 03:50:31 +08:00
which git
2010-01-06 07:57:22 +08:00
if [ $? != 0 ]; then
2010-07-01 03:50:31 +08:00
echo "# Installing git and ant"
sudo apt-get install git ant -y --force-yes
2010-01-06 07:57:22 +08:00
fi
2010-07-01 03:50:31 +08:00
BBBSRCGIT="~/dev/source/bigbluebutton"
if [ -d $BBBSRCGIT ]; then
echo "# "
echo "**** ERROR: ${BBBSRCGIT} exists. ***"
echo "**** ERROR: You have already checked-out bigbluebutton. Please delete ${BBBSRCGIT} and try again. ***"
echo "# "
exit 1
fi
2010-01-06 07:57:22 +08:00
2009-11-04 09:18:58 +08:00
if [ ! -d ~/dev ]; then
2010-07-01 03:50:31 +08:00
echo "# Creating dev directory"
2009-11-04 09:18:58 +08:00
mkdir ~/dev
fi
2010-07-01 03:50:31 +08:00
echo "# Changing to the dev directory"
cd ~/dev
if [ ! -d ~/dev/source ]; then
echo "# Creating source directory"
mkdir ~/dev/source
fi
echo "# Changing to the dev directory"
cd ~/dev/source
echo "# "
2010-09-04 03:03:27 +08:00
echo "# Cloning BigBlueButton."
2010-07-01 03:50:31 +08:00
echo "# "
echo "# "
2010-07-03 23:36:10 +08:00
git clone $CHECKOUT
2010-09-04 03:03:27 +08:00
cd ~/dev/source/bigbluebutton
echo " Checking out version 0.7 "
git checkout -b 0.7-release-workspace v0.7
2010-07-01 03:50:31 +08:00
echo "# "
echo "# "
2010-07-03 23:36:10 +08:00
echo "# Checked out BigBlueButton. "
2010-07-01 03:50:31 +08:00
echo "# "
echo " You can now run 'bbb-conf --setup-dev [client|web|apps]' to setup dev environment "
echo "# "
fi
if [ $SETUPDEV ]; then
check_root
2009-11-04 08:33:36 +08:00
2010-07-01 03:50:31 +08:00
if [ ! -d ~/dev/source/bigbluebutton ]; then
echo "# "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
fi
2009-11-04 08:33:36 +08:00
2010-01-24 03:31:34 +08:00
2010-07-01 03:50:31 +08:00
if [ $SETUPDEV == "web" ]; then
BBBWEBHOME=~/dev/source/bigbluebutton/bigbluebutton-web
if [ ! -d $BBBWEBHOME ]; then
echo "# "
echo "*** ERROR: Cannot find ${BBBWEBHOME} "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
fi
2009-11-04 08:33:36 +08:00
2010-07-01 03:50:31 +08:00
echo "# Copying the bigbluebutton.properites in /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties to ~/.grails/bigbluebutton-config.properties"
mkdir -p ~/.grails
cp /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties ~/.grails/bigbluebutton-config.properties
2010-04-03 01:37:06 +08:00
2010-07-01 03:50:31 +08:00
echo "# Copying the bbb_api_conf.jsp into /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties to ${BBBWEBHOME}/web-app/demo"
cp /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp ${BBBWEBHOME}/web-app/demo
2010-06-29 04:10:29 +08:00
2010-07-01 03:50:31 +08:00
echo "# Enabling $USER to write to /var/bigbluebutton to upload slides"
sudo chmod -R ugo+rwx /var/bigbluebutton
2010-06-29 04:10:29 +08:00
2010-07-01 03:50:31 +08:00
echo "# Enabling $USER to write to /var/log/bigbluebutton to write log files"
sudo chmod -R ugo+rwx /var/log/bigbluebutton
2010-06-29 04:10:29 +08:00
2010-07-13 21:42:13 +08:00
echo "# Copying bbb-common-message-0.7.jar into ${BBBWEBHOME}/lib"
if [ -f $RED5_DIR/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.7.jar ]; then
cp /usr/share/red5/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.7.jar ${BBBWEBHOME}/lib
2010-07-01 03:50:31 +08:00
fi
echo "
2009-11-06 02:33:28 +08:00
# Done. To run your local build of bbb-web:
2010-07-01 03:50:31 +08:00
sudo /etc/init.d/${TOMCAT} stop
cd ${BBBWEBHOME}
ant
2009-11-06 02:33:28 +08:00
"
2010-07-01 03:50:31 +08:00
fi
2009-11-04 10:23:54 +08:00
2009-11-04 09:18:58 +08:00
2010-07-01 03:50:31 +08:00
if [ $SETUPDEV == "client" ]; then
BBBCLIENTHOME=~/dev/source/bigbluebutton/bigbluebutton-client
if [ ! -d $BBBCLIENTHOME ]; then
echo "# "
echo "*** ERROR: Cannot find ${BBBCLIENTHOME} "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
fi
2009-11-04 09:18:58 +08:00
2010-07-01 03:50:31 +08:00
#
# Setup the directories so we can point /etc/nginx/sites-available/bigbluebutton to this
# local copy of the client
#
if [ ! -d $BBBCLIENTHOME/bin ]; then
mkdir -p $BBBCLIENTHOME/bin
fi
2009-11-04 10:23:54 +08:00
2010-07-01 03:50:31 +08:00
if [ ! -d $BBBCLIENTHOME/conf ]; then
mkdir -p $BBBCLIENTHOME/bin/conf
fi
2009-11-04 10:23:54 +08:00
2010-07-01 03:50:31 +08:00
if [ ! -h $BBBCLIENTHOME/client ]; then
ln -s $BBBCLIENTHOME/bin $BBBCLIENTHOME/client
fi
2009-11-04 09:18:58 +08:00
2010-07-01 03:50:31 +08:00
echo "Modifying /etc/nginx/sites-available/bigbluebutton to point to your local copy of bbb-client"
sudo sed -i "s/\/var\/www\/bigbluebutton;/\/home\/firstuser\/dev\/source\/bigbluebutton\/bigbluebutton-client;/g" \
/etc/nginx/sites-available/bigbluebutton
sudo /etc/init.d/nginx restart
2009-11-04 10:23:54 +08:00
2010-07-06 03:15:51 +08:00
echo "# Copying /var/www/bigbluebutton/client/conf/config.xml to ${BBBCLIENTHOME}/src/conf/config.xml"
cp /var/www/bigbluebutton/client/conf/config.xml $BBBCLIENTHOME/src/conf/config.xml
2010-01-06 07:57:22 +08:00
2010-07-15 04:30:53 +08:00
echo "# Copying ${BBBCLIENTHOME}/resources/dev/join-mock.xml to ${BBBCLIENTHOME}/src/conf/join-mock.xml"
cp $BBBCLIENTHOME/resources/dev/join-mock.xml $BBBCLIENTHOME/src/conf/join-mock.xml
if [ ! -d /var/bigbluebutton/conference-mock-default/conference-mock-default/room-mock-default ]; then
echo "# Creating /var/bigbluebutton/conference-mock-default/conference-mock-default/room-mock-default"
sudo mkdir -p /var/bigbluebutton/conference-mock-default/conference-mock-default/room-mock-default
echo "# chown /var/bigbluebutton/conference-mock-default to tomcat6"
sudo chown -R tomcat6.tomcat6 /var/bigbluebutton/conference-mock-default
fi
2010-07-01 03:50:31 +08:00
cd $BBBCLIENTHOME
2010-07-01 03:28:54 +08:00
2010-07-01 03:50:31 +08:00
echo "
2009-11-06 02:33:28 +08:00
# Done. To build your local build of bbb-client:
2009-11-05 12:08:22 +08:00
2010-07-01 03:50:31 +08:00
cd ${BBBCLIENTHOME}
ant
2009-11-06 02:33:28 +08:00
2010-07-01 03:50:31 +08:00
# The nginx server now loads the BigBlueButton Flash client from
# ${BBBCLIENTHOME}.
2009-11-05 12:08:22 +08:00
"
2010-07-01 03:50:31 +08:00
fi
2009-11-04 10:23:54 +08:00
2010-07-01 03:50:31 +08:00
if [ $SETUPDEV == "apps" ]; then
BBBAPPSHOME=~/dev/source/bigbluebutton/bigbluebutton-apps
if [ ! -d $BBBAPPSHOME ]; then
echo "# "
echo "*** ERROR: Cannot find ${BBBAPPSHOME} "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
fi
2010-06-29 04:10:29 +08:00
2010-07-13 21:42:13 +08:00
echo "# Checking if ~/dev/repo/bbb-common-message-0.7.jar is present"
if [ ! -f ~/dev/repo/bbb-common-message-0.7.jar ]; then
echo "# Copying bbb-common-message-0.7.jar into ${BBBAPPSHOME}"
if [ -f $RED5_DIR/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.7.jar ]; then
2010-07-01 03:50:31 +08:00
if [ ! -d ~/dev/repo ]; then
mkdir -p ~/dev/repo
fi
2010-07-13 21:42:13 +08:00
cp /usr/share/red5/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.7.jar ~/dev/repo/
2010-04-03 03:44:51 +08:00
else
2010-07-13 21:42:13 +08:00
echo "# $RED5_DIR/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.7.jar does NOT exist!"
2010-04-03 03:44:51 +08:00
fi
fi
2009-11-05 12:08:22 +08:00
2010-07-01 03:50:31 +08:00
#
# We're going to make it easier to deploy by giving write access to others to
2010-07-07 22:57:20 +08:00
# $RED5_DIR/webapps
2010-07-01 03:50:31 +08:00
#
2010-07-12 20:52:51 +08:00
sudo chmod -R o+w $RED5_DIR/webapps
2010-07-01 03:50:31 +08:00
#
# Let's remove the existing bbb-apps
#
if dpkg-query -s bbb-apps | grep "install ok installed" > /dev/null 2>&1; then
sudo apt-get purge --yes bbb-apps
fi
2010-06-29 04:10:29 +08:00
2010-07-01 03:50:31 +08:00
if [ ! -f ~/.bbb-apps-build.properties ]; then
echo "#
2009-11-05 12:08:22 +08:00
# Override the default properties for bbb-apps
#
2010-07-07 22:57:20 +08:00
red5.home = $RED5_DIR
2009-11-05 12:08:22 +08:00
" > ~/.bbb-apps-build.properties
2010-07-01 03:50:31 +08:00
fi
2009-11-05 12:08:22 +08:00
2010-07-08 23:47:52 +08:00
if [ ! -L /etc/nginx/sites-enabled/bigbluebutton ]; then
echo " No symbolic link in /etc/nginx/sites-enabled/bigbluebutton to /etc/nginx/sites-available/bigbluebutton "
2010-07-12 02:21:31 +08:00
sudo ln -s /etc/nginx/sites-available/bigbluebutton /etc/nginx/sites-enabled/bigbluebutton
2010-07-08 23:47:52 +08:00
fi
2010-07-01 03:50:31 +08:00
#
# Setup the directories so we can point /etc/nginx/sites-available/bigbluebutton to this
# local copy of the client
#
echo "
2009-11-05 12:08:22 +08:00
# Done. To run your local build of bbb-apps:
sudo /etc/init.d/red5 stop
2010-07-01 03:50:31 +08:00
cd ${BBBAPPSHOME}
2010-03-05 04:38:08 +08:00
gradle war deploy
2010-07-07 22:57:20 +08:00
cd $RED5_DIR
2010-07-01 03:50:31 +08:00
sudo -u red5 ./red5.sh
2009-11-05 12:08:22 +08:00
# To restore the packaged version of bbb-apps:
2010-07-07 22:57:20 +08:00
rm -rf $RED5_DIR/webapps/bigbluebutton
2010-04-03 06:56:28 +08:00
sudo apt-get install bigbluebutton
2009-11-05 12:08:22 +08:00
sudo /etc/init.d/red5 start
"
2010-07-01 03:50:31 +08:00
fi
2009-11-04 08:33:36 +08:00
fi
2010-01-19 10:20:22 +08:00
if [ $RESET_DEV ]; then
check_root
echo "Reseting /etc/nginx/sites-available/bigbluebutton to point to /var/www/bigbluebutton"
2010-07-01 03:27:01 +08:00
sudo sed -i "s/\/home\/firstuser\/dev\/source\/bigbluebutton\/bigbluebutton-client;/\/var\/www\/bigbluebutton;/g" \
2010-01-19 10:20:22 +08:00
/etc/nginx/sites-available/bigbluebutton
sudo /etc/init.d/nginx restart
fi
2010-01-16 10:40:58 +08:00
check_state() {
2010-07-08 05:11:27 +08:00
echo
2010-07-08 04:17:55 +08:00
print_header
2010-01-16 22:28:53 +08:00
2009-11-06 06:48:31 +08:00
#
# Check for potential problems
#
2010-09-20 09:47:17 +08:00
2010-07-08 01:52:49 +08:00
RUNNING_APPS=""
NOT_RUNNING_APPS=""
2010-09-20 09:47:17 +08:00
2010-07-08 04:17:55 +08:00
if ! ps aux | grep -v grep | grep "$ACTIVEMQ_DIR" > /dev/null; then
2009-11-06 04:57:56 +08:00
print_header
2010-07-08 01:52:49 +08:00
NOT_RUNNING_APPS="ActiveMQ"
else
RUNNING_APPS="ActiveMQ"
2009-11-06 04:57:56 +08:00
fi
2010-07-08 04:17:55 +08:00
if ! ps aux | grep -v grep | grep 'org.red5.server.Bootstrap' > /dev/null; then
2009-11-06 04:57:56 +08:00
print_header
2010-07-08 01:52:49 +08:00
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} Red5"
else
RUNNING_APPS="${RUNNING_APPS} Red5"
2009-11-06 04:57:56 +08:00
fi
2010-08-24 02:28:37 +08:00
#check asterisk if asterisk has been started
#same for freeswitch
if [ -a /var/run/asterisk/asterisk.pid ] && [ -a /opt/freeswitch/run/freeswitch.pid ]; then
2009-11-06 04:57:56 +08:00
print_header
2010-08-24 02:28:37 +08:00
echo "Asterisk and Freeswitch are running parallel"
echo "Please run bbb-conf freeswitch or bbb-conf asterisk"
elif [ -a /var/run/asterisk/asterisk.pid ]; then
if ! ps aux | grep -v grep | grep '[/]usr/sbin/asterisk' > /dev/null; then
print_header
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} Asterisk"
else
RUNNING_APPS="${RUNNING_APPS} Asterisk"
fi
elif [ -a /opt/freeswitch/run/freeswitch.pid ]; then
if ! ps aux | grep -v grep | grep '[/]opt/freeswitch/bin/freeswitch' > /dev/null; then
print_header
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} Freeswitch"
else
RUNNING_APPS="${RUNNING_APPS} Freeswitch"
fi
2010-08-24 00:12:04 +08:00
fi
2010-09-20 09:47:17 +08:00
if ! ps aux | grep -v grep | grep '[/]usr/lib/openoffice/program/soffice.bin' > /dev/null; then
2010-08-24 00:12:04 +08:00
print_header
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} OpenOffice"
else
RUNNING_APPS="${RUNNING_APPS} OpenOffice"
2009-11-06 04:57:56 +08:00
fi
2010-07-08 04:17:55 +08:00
if ! ps aux | grep -v grep | grep '[/]usr/sbin/nginx' > /dev/null; then
2009-11-06 07:14:17 +08:00
print_header
2010-07-08 01:52:49 +08:00
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} Nginx"
else
RUNNING_APPS="${RUNNING_APPS} Nginx"
2009-11-06 07:14:17 +08:00
fi
2009-11-06 04:57:56 +08:00
if ! netstat -ant | grep '8080' > /dev/null; then
print_header
2010-07-08 01:52:49 +08:00
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} ${TOMCAT} or grails"
2009-12-12 05:20:34 +08:00
else
2010-07-08 04:17:55 +08:00
if ps aux | ps -aef | grep -v grep | grep grails | grep run-app > /dev/null; then
2009-12-12 05:20:34 +08:00
print_header
2010-07-08 01:52:49 +08:00
RUNNING_APPS="${RUNNING_APPS} Grails"
echo " ${TOMCAT}: noticed you are running grails run-app instead of tomcat"
else
RUNNING_APPS="${RUNNING_APPS} ${TOMCAT}"
2009-12-12 05:20:34 +08:00
fi
fi
2009-11-06 04:57:56 +08:00
2010-07-08 01:52:49 +08:00
if ! netstat -ant | grep '8100' > /dev/null; then
print_header
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} OpenOffice"
else
RUNNING_APPS="${RUNNING_APPS} OpenOffice"
fi
2010-09-20 09:47:17 +08:00
2010-07-08 04:17:55 +08:00
#echo " Running: ${RUNNING_APPS}"
if [ "$NOT_RUNNING_APPS" != "" ]; then
echo " Not Running: ${NOT_RUNNING_APPS}"
fi
2010-09-20 09:47:17 +08:00
#
# Check if bigbluebutton is definied in nginx
#
2009-11-06 04:57:56 +08:00
if [ ! -L /etc/nginx/sites-enabled/bigbluebutton ]; then
2010-07-08 01:52:49 +08:00
echo "Nginx: bigbluebutton disabled"
echo " - no symbolic link in /etc/nginx/sites-enabled/bigbluebutton to /etc/nginx/sites-available/bigbluebutton "
2009-11-06 04:57:56 +08:00
fi
2010-09-20 09:47:17 +08:00
2010-07-08 01:52:49 +08:00
if grep -v \# /etc/nginx/sites-available/bigbluebutton | grep /home/firstuser/dev/source/bigbluebutton/bigbluebutton-client > /dev/null; then
echo "Nginx: serving client from /home/firstuser/dev/source/bigbluebutton/bigbluebutton-client"
echo " instead of the usual /var/www/bigbluebutton"
2009-12-12 05:20:34 +08:00
fi
2010-09-20 09:47:17 +08:00
#
# Checking red5 apps
#
2010-07-08 01:52:49 +08:00
AVAIL_RED5_APPS=""
UNAVAIL_RED5_APPS=""
2010-09-20 09:47:17 +08:00
DIRECTORIES="bigbluebutton sip video deskshare"
2009-11-06 06:48:31 +08:00
for dir in $DIRECTORIES ; do
2010-07-07 22:57:20 +08:00
if [ ! -d $RED5_DIR/webapps/$dir ]; then
2010-07-08 01:52:49 +08:00
UNAVAIL_RED5_APPS="${UNAVAIL_RED5_APPS} $dir"
else
AVAIL_RED5_APPS="${AVAIL_RED5_APPS} $dir"
2009-11-06 06:48:31 +08:00
fi
done
2010-09-20 09:47:17 +08:00
2010-07-08 04:17:55 +08:00
if [ "$UNAVAIL_RED5_APPS" != "" ]; then
echo "Unavailable Red5 apps ($RED5_DIR/webapps/): ${UNAVAIL_RED5_APPS}"
fi
2010-09-20 09:47:17 +08:00
#
# Checking red5 apps log
#
RED5_LOG_FILES="bigbluebutton red5 sip video deskshare"
2010-07-08 01:52:49 +08:00
AVAIL_RED5_LOG=""
UNAVAIL_RED5_LOG=""
2009-11-06 06:48:31 +08:00
for file in $RED5_LOG_FILES ; do
2010-07-07 22:57:20 +08:00
if [ ! -f $RED5_DIR/log/$file.log ]; then
2010-07-08 01:52:49 +08:00
UNAVAIL_RED5_LOG="${UNAVAIL_RED5_LOG} $file.log"
else
AVAIL_RED5_LOG="${AVAIL_RED5_LOG} $file.log"
2009-11-06 06:48:31 +08:00
fi
done
2010-09-20 09:47:17 +08:00
2010-07-08 04:17:55 +08:00
if [ "$UNAVAIL_RED5_LOG" != "" ]; then
echo "Unavailable Red5 logs ($RED5_DIR/log): $UNAVAIL_RED5_LOG"
fi
2010-09-20 09:47:17 +08:00
2010-01-16 10:40:58 +08:00
#
# Make sure the salt for the API matches the server
#
2010-03-09 23:32:20 +08:00
SALT_PROPERTIES=$(cat /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | tr -d '\r' | sed -n '/securitySalt/{s/.*=//;p}')
SALT_DEMO=$(cat /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp | tr -d '\r' | sed -n '/salt =/{s/.* = "//;s/".*//g;p}')
2010-09-20 09:47:17 +08:00
2010-01-04 01:45:31 +08:00
if [ "$SALT_PROPERTIES" != "$SALT_DEMO" ]; then
2010-07-08 04:17:55 +08:00
echo "Salt mismatch: "
echo " /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties=$SALT_PROPERTIES"
echo " /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp=$SALT_DEMO"
2010-01-04 01:45:31 +08:00
fi
2010-09-20 09:47:17 +08:00
2010-01-16 10:40:58 +08:00
#
# Look for properties with no values set
#
2010-07-07 22:57:20 +08:00
CONFIG_FILES="$RED5_DIR/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties \
2010-03-09 23:32:20 +08:00
/var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties \
2010-07-07 22:57:20 +08:00
$RED5_DIR/webapps/sip/WEB-INF/bigbluebutton-sip.properties"
2010-01-13 11:44:50 +08:00
for file in $CONFIG_FILES ; do
2010-07-08 01:52:49 +08:00
if [ ! -f $file ]; then
echo " $file not found"
else
if grep -q "^[^=]*=[ ]*$" $file; then
2010-07-09 01:09:17 +08:00
echo " The following properties in $file has no value."
echo " $(grep '^[^=]*=[ ]*$' $file | sed 's/=//g')"
2010-07-08 01:52:49 +08:00
fi
2010-01-13 11:44:50 +08:00
fi
done
2010-09-20 09:47:17 +08:00
#
# Check if any of the red5 BigBlueButton applications did not start propery
#
2010-07-08 04:17:55 +08:00
BBB_APPS="sip video bigbluebutton"
2010-07-08 01:52:49 +08:00
for bbb_app in $BBB_APPS ; do
if [ -a $RED5_DIR/log/$bbb_app.log ]; then
if cat $RED5_DIR/log/$bbb_app.log | tail -n1 | grep -q "Starting up context"; then
echo " $bbb_app did not start properly"
2010-07-01 03:57:39 +08:00
fi
else
2010-07-08 01:52:49 +08:00
echo " " $RED5_DIR/log/$bbb_app.log "not found"
2010-07-01 03:57:39 +08:00
fi
done
2010-09-20 09:47:17 +08:00
#
# check if sip.log has warnings where the user is not registered.
#
2010-07-01 03:57:39 +08:00
if cat /usr/share/red5/log/sip.log | tail -n1 | grep -q "Call request for default but not registered"; then
2010-07-13 22:33:51 +08:00
echo "The voice app is not registered with SIP server. Audio might not be working correctly."
2010-07-01 03:57:39 +08:00
fi
2010-09-20 09:47:17 +08:00
#
# Checking if voice app registered with Asterisk successfully
#
2010-07-07 22:32:16 +08:00
if cat /usr/share/red5/log/sip.log | grep -q "Failed to register with Sip Server"; then
2010-09-20 09:47:17 +08:00
echo " The voice application failed to register with the sip server. Try running: sudo bbb-conf --clean"
2010-07-07 22:32:16 +08:00
fi
2010-07-01 03:57:39 +08:00
2010-01-16 10:40:58 +08:00
#
# Check that tomcat6 started properly and has created log files
#
2010-02-09 05:22:16 +08:00
if [ -z "$(ls -A $TOMCAT6_LOGS)" ]; then
echo " empty directory: $TOMCAT6_LOGS contains no logs"
2010-01-15 11:00:52 +08:00
fi
2010-01-13 11:44:50 +08:00
2010-01-16 10:40:58 +08:00
#
2010-09-20 09:47:17 +08:00
# Check that bigbluebutton in red5 has started propertly (less than 100 lines indicates that it
# didn't start)
2010-01-16 10:40:58 +08:00
#
2010-07-08 23:47:52 +08:00
BBB_RED5_LOG=$(stat -c%s $RED5_DIR/log/bigbluebutton.log)
if [ $BBB_RED5_LOG -lt 100 ]; then
2010-07-07 22:57:20 +08:00
echo " bigbluebutton failed to start: $RED5_DIR/log/bigbluebutton.log (red5)"
2010-01-16 10:40:58 +08:00
fi
2010-07-14 23:55:33 +08:00
2010-09-20 09:47:17 +08:00
#
# Check if the IP resolves to a different host
#
2010-01-16 10:55:12 +08:00
NGINX_IP=$(cat /etc/nginx/sites-available/bigbluebutton | sed -n '/server_name/{s/.*name[ ]*//;s/;//;p}')
2010-07-14 23:55:33 +08:00
HOSTS=$(which host)
if [ $HOSTS ]; then
HOSTS=`$HOSTS $NGINX_IP | awk '{ print $4 }'`
fi
2010-09-20 09:47:17 +08:00
if [ "$IP" != "$NGINX_IP" ]; then
if [ "$IP" != "$HOSTS" ]; then
2010-07-14 23:55:33 +08:00
echo "IP does not match:"
2010-09-20 09:47:17 +08:00
echo " IP from ifconfig: $IP"
echo " /etc/nginx/sites-available/bigbluebutton: $NGINX_IP"
2010-07-14 23:55:33 +08:00
fi
2010-01-16 10:55:12 +08:00
fi
2010-09-20 09:47:17 +08:00
#
# Check that the supporting applications are installed
#
VARFolder=$(cat /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | grep swfToolsDir | cut -d= -f2)
2010-07-06 03:48:41 +08:00
if [ ! -x $VARFolder/pdf2swf ] && [ ! -x $VARFolder/jpeg2swf ] && [ ! -x $VARFolder/png2swf ]; then
echo "pdf2swf, jpeg2swf and png2swf are not installed in $VARFolder"
2010-07-06 01:02:04 +08:00
fi
VARFolder=$(cat /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | grep imageMagickDir | cut -d= -f2)
2010-07-06 03:48:41 +08:00
if [ ! -x $VARFolder/convert ]; then
2010-07-13 22:33:51 +08:00
echo "ImageMagick's convert is not installed in $VARFolder"
2010-07-06 01:02:04 +08:00
fi
VARFolder=$(cat /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | grep ghostScriptExec | cut -d= -f2)
2010-07-06 03:48:41 +08:00
if [ ! -x $VARFolder ]; then
echo "Ghostscript is not installd in $VARFolder"
2010-07-06 01:02:04 +08:00
fi
2010-09-20 09:47:17 +08:00
#
# Check if the deskshare module is installed but disalbed
#
2010-07-14 05:13:49 +08:00
if dpkg -l | grep -q bbb-apps-deskshare; then
2010-07-13 02:06:01 +08:00
if grep -q -i '<!--[ ]*module name="DeskShareModule"' /var/www/bigbluebutton/client/conf/config.xml; then
2010-09-20 09:47:17 +08:00
echo "The DeskShare module is disabled in /var/www/bigbluebutton/client/conf/config.xml."
2010-07-07 03:31:47 +08:00
fi
2010-07-07 02:48:33 +08:00
else
#check for DeskShare.log
2010-07-07 22:57:20 +08:00
if [ -a $RED5_DIR/log/deskshare.log ]; then
if cat $RED5_DIR/log/deskshare.log | tail -n1 | grep -q "Starting up context"; then
2010-07-13 22:33:51 +08:00
echo "Deskshare did not start up correctly"
2010-07-07 02:48:33 +08:00
fi
fi
2010-07-07 02:19:59 +08:00
fi
2010-09-20 09:47:17 +08:00
#
# Check if the local server can access the API. This is a common problem when setting up BigBlueButton behind
# a firewall
#
if ! wget http://$NGINX_IP/bigbluebutton/api -O - --quiet | grep -q SUCCESS; then
echo
echo " This server could not connect to BigBlueButton through http://$NGINX_IP/"
2010-10-04 11:27:23 +08:00
echo
echo " If you are setting up BigBlueButton behind a firewall, see the FAQ"
echo " for steps to setup BigBlueButton behind a firewall."
echo " http://code.google.com/p/bigbluebutton/wiki/FAQ"
2010-09-20 09:47:17 +08:00
echo
fi
2010-10-04 11:27:23 +08:00
#
# Check that BigBlueButton can connect to port 80, 1935, and 9123
#
if ! nc -z -w 3 $NGINX_IP 80; then
echo
echo "Unable to connect to port 80 on $NGINX_IP"
fi
if ! nc -z -w 3 $NGINX_IP 1935; then
echo
echo "Unable to connect to port 1935 (RTMP) on $NGINX_IP"
fi
if ! nc -z -w 3 $NGINX_IP 9123; then
echo
echo "Unable to connect to port 9123 (desktop sharing) on $NGINX_IP"
fi
2009-12-10 06:49:49 +08:00
exit 0
}
2009-11-06 06:48:31 +08:00
2009-12-10 06:49:49 +08:00
#
# Check current setup
#
2010-08-12 01:27:50 +08:00
# TODO:
# Check if asterisk and freeswitch are running
2009-12-10 06:49:49 +08:00
if [ $CHECK ]; then
2010-10-04 11:27:23 +08:00
echo "Server"
echo " Kernel version:" `uname -r`
if [ -e /etc/lsb-release ]; then
source /etc/lsb-release;
echo -n " Distribution: $DISTRIB_DESCRIPTION "
fi
2010-07-05 21:16:33 +08:00
if [ `uname -m` == "x86_64" ]; then
2010-10-04 11:27:23 +08:00
echo "64bit"
2010-07-05 21:16:33 +08:00
elif [ `uname -m` == "x86" ]; then
2010-10-04 11:27:23 +08:00
echo "32bit"
2010-07-05 21:16:33 +08:00
fi
2009-12-10 06:49:49 +08:00
2010-10-04 11:27:23 +08:00
MEM=`free -m | grep Mem | awk '{ print $2}'`
echo " Memory: $MEM MB"
2010-08-31 21:48:54 +08:00
2009-12-10 06:49:49 +08:00
echo
2010-10-04 11:27:23 +08:00
echo "/var/www/bigbluebutton/client/conf/config.xml"
2010-07-08 01:52:49 +08:00
IP=$(cat /var/www/bigbluebutton/client/conf/config.xml | sed -n '/porttest /{s/.*host="//;s/".*//;p}')
2010-07-14 05:13:49 +08:00
echo " Port test (tunnel): $IP"
2009-12-10 06:49:49 +08:00
IP=$(cat /var/www/bigbluebutton/client/conf/config.xml | sed -n '/uri.*video/{s/.*rtmp:\/\///;s/\/.*//;p}')
2010-07-14 05:13:49 +08:00
echo " Red5: $IP"
2009-12-10 06:49:49 +08:00
2010-07-08 01:52:49 +08:00
# HOST=$(cat /var/www/bigbluebutton/client/conf/config.xml | sed -n '/recordingHost/{s/.*recordingHost="http:\/\///;s/"//;p}')
# echo " host for bbb-web interface: $HOST"
2009-12-10 06:49:49 +08:00
echo
2010-07-08 01:52:49 +08:00
echo "/etc/nginx/sites-available/bigbluebutton"
IP=$(cat /etc/nginx/sites-available/bigbluebutton | sed -n '/server_name/{s/.*name[ ]*//;s/;//;p}')
2010-07-14 05:13:49 +08:00
echo " server name: $IP"
2009-12-10 06:49:49 +08:00
PORT=$(cat /etc/nginx/sites-available/bigbluebutton | sed -n '/listen/{s/.*listen[ ]*//;s/;//;p}')
2010-07-14 05:13:49 +08:00
echo " port: $PORT"
2009-12-10 06:49:49 +08:00
2010-07-07 22:47:33 +08:00
BBB_CLIENT_DOC_ROOT=$(cat /etc/nginx/sites-available/bigbluebutton | grep \/client -A 1 | head -n 2 | grep root | sed -n '{s/[ ]*root[ ]*//;s/;//;p}')
2010-07-14 05:13:49 +08:00
echo " bbb-client dir: $BBB_CLIENT_DOC_ROOT"
2009-12-10 06:49:49 +08:00
2010-09-20 09:47:17 +08:00
IP=$(cat /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | sed -n '/^bigbluebutton.web.serverURL/{s/.*\///;p}')
2009-12-10 06:49:49 +08:00
echo
2010-03-09 23:32:20 +08:00
echo "/var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties (bbb-web)"
2010-09-20 09:47:17 +08:00
echo " bbb-web host: $IP"
2009-12-10 06:49:49 +08:00
2010-03-09 23:32:20 +08:00
if [ -f /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp ]; then
2010-09-20 09:47:17 +08:00
IP=$(cat /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp | sed -n '/String BigBlueButtonURL/{s/.*http:\/\///;s/\/.*//;p}' | tr -d '\015')
2009-12-24 11:02:55 +08:00
echo
2010-03-09 23:32:20 +08:00
echo "/var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp (API demos)"
2010-09-20 09:47:17 +08:00
echo " bbb-web-api host: $IP"
2009-12-24 11:02:55 +08:00
fi
2010-01-16 22:28:53 +08:00
if ps aux | grep '[/]usr/sbin/asterisk' > /dev/null; then
2010-07-07 22:57:20 +08:00
CONFERENCING_MODULE=$(cat $RED5_DIR/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties | sed -n '/asterisk.application/{s/.*=[ ]*//g;p}')
2010-01-16 22:28:53 +08:00
echo
echo "/etc/asterisk/bbb_extensions.conf (asterisk)"
2010-07-14 05:13:49 +08:00
echo " voice conf application: $CONFERENCING_MODULE"
2010-01-16 22:28:53 +08:00
fi
check_state
2009-12-10 06:49:49 +08:00
exit 0
fi
2010-01-06 07:57:22 +08:00
#
# Check current setup
#
if [ $ZIP ]; then
need_root
LOG_FILE="$(date +'%Y%m%d')-$(date +%H)"
#
# Check log files
#
rm -f /tmp/$LOG_FILE.tar
rm -f /tmp/$LOG_FILE.tar.gz
rm -f /tmp/a
2010-01-15 11:00:52 +08:00
touch /tmp/empty
tar cf /tmp/$LOG_FILE.tar /tmp/empty > /dev/null 2>&1
2010-07-07 22:57:20 +08:00
tar rf /tmp/$LOG_FILE.tar $RED5_DIR/log > /dev/null 2>&1
2010-03-09 23:32:20 +08:00
tar rf /tmp/$LOG_FILE.tar $TOMCAT6_LOGS > /dev/null 2>&1
2010-01-13 11:44:50 +08:00
tar rf /tmp/$LOG_FILE.tar /var/log/bigbluebutton/* > /dev/null 2>&1
2010-01-06 07:57:22 +08:00
tar rf /tmp/$LOG_FILE.tar /var/log/nginx/error.log > /dev/null 2>&1
tar rf /tmp/$LOG_FILE.tar /var/log/syslog > /dev/null 2>&1
tar tf /tmp/$LOG_FILE.tar
gzip /tmp/$LOG_FILE.tar
2010-01-15 11:00:52 +08:00
mv /tmp/$LOG_FILE.tar.gz /root/$LOG_FILE.tar.gz
echo
echo " Created: /root/$LOG_FILE.tar.gz"
2010-01-06 07:57:22 +08:00
echo
fi
2009-12-10 06:49:49 +08:00
#
# Check current setup
#
if [ $DEBUG ]; then
2009-12-12 05:20:34 +08:00
need_root
2009-12-09 10:37:32 +08:00
#
# Check log files
#
2010-07-14 04:14:26 +08:00
rm -rf /tmp/t
grep ERROR /var/log/bigbluebutton/* > /tmp/t
if [ -s /tmp/t ]; then
echo " -- ERRORS found in /var/log/bigbluebutton/* -- "
cat /tmp/t
echo
fi
rm -rf /tmp/t
2010-07-14 07:09:50 +08:00
grep Exception /var/log/bigbluebutton/* | grep -v CacheExceptionHandlerFactory > /tmp/t
2010-07-14 04:14:26 +08:00
if [ -s /tmp/t ]; then
echo " -- ERRORS found in /var/log/bigbluebutton/* -- "
cat /tmp/t
echo
fi
2009-12-09 10:37:32 +08:00
rm -rf /tmp/t
2010-07-07 22:57:20 +08:00
grep ERROR $RED5_DIR/log/* > /tmp/t
2009-12-09 10:37:32 +08:00
if [ -s /tmp/t ]; then
2010-07-07 22:57:20 +08:00
echo " -- ERRORS found in $RED5_DIR/log/* -- "
2009-12-09 10:37:32 +08:00
cat /tmp/t
echo
fi
rm -rf /tmp/t
2010-07-07 22:57:20 +08:00
grep Exception $RED5_DIR/log/* > /tmp/t
2009-12-09 10:37:32 +08:00
if [ -s /tmp/t ]; then
2010-07-07 22:57:20 +08:00
echo " -- Exceptions found in $RED5_DIR/log/* -- "
2009-12-09 10:37:32 +08:00
cat /tmp/t
echo
fi
rm -rf /tmp/t
find /var/log/asterisk -exec grep -H -i "Unable to register" '{}' \; > /tmp/t
if [ -s /tmp/t ]; then
echo " -- Registration errors found in /var/log/asterisk/ -- "
echo "Found $(cat /tmp/t | wc -l) errors in /var/log/asterisk/* containing string \"Unable to register\""
echo
fi
rm -rf /tmp/t
2010-07-07 22:32:16 +08:00
sudo grep Exception $TOMCAT6_LOGS/* | grep -v CacheExceptionHandlerFactory > /tmp/t
2009-12-09 10:37:32 +08:00
if [ -s /tmp/t ]; then
2010-02-09 05:22:16 +08:00
echo " -- Exceptions found in $TOMCAT6_LOGS/ -- "
2009-12-09 10:37:32 +08:00
cat /tmp/t
echo
fi
2010-01-02 10:17:11 +08:00
rm -rf /tmp/t
if [ -s /var/log/nginx/error.log ]; then
cat /var/log/nginx/error.log | grep -v "/fcs/ident2" > /tmp/t
if [ -s /tmp/t ]; then
echo " -- Errors found in /var/log/nginx/error.log -- "
cat /tmp/t
echo
fi
fi
2009-12-12 05:20:34 +08:00
2009-12-13 22:34:01 +08:00
rm -rf /tmp/t
2010-03-09 23:32:20 +08:00
if [ ! is_gentoo ]; then sudo grep -v "No Voicetronix cards detected" /var/log/asterisk/* | grep ERROR > /tmp/t
if [ -s /tmp/t ]; then
2009-12-13 22:34:01 +08:00
echo " -- Errors found in /var/log/asterisk/* -- "
cat /tmp/t
echo
2010-03-09 23:32:20 +08:00
fi
2009-12-13 22:34:01 +08:00
fi
2009-12-12 05:20:34 +08:00
2009-12-20 07:33:29 +08:00
rm -rf /tmp/t
2010-03-09 23:32:20 +08:00
if [ ! is_gentoo ]; then sudo grep -i exception /var/log/syslog > /tmp/t
if [ -s /tmp/t ]; then
2009-12-20 07:33:29 +08:00
echo " -- Errors found in /var/log/syslog -- "
cat /tmp/t
echo
2010-03-09 23:32:20 +08:00
fi
2009-12-20 07:33:29 +08:00
fi
2009-12-24 11:02:55 +08:00
rm -rf /tmp/t
if [ -d /var/log/bigbluebutton ]; then
2010-03-09 23:32:20 +08:00
if [ ! is_gentoo ]; then
sudo grep ERROR /var/log/bigbluebutton/* > /tmp/t
if [ -s /tmp/t ]; then
2009-12-24 11:02:55 +08:00
echo " -- Errors found in /var/log/bigbluebutton -- "
cat /tmp/t
echo
2010-03-09 23:32:20 +08:00
fi
2009-12-24 11:02:55 +08:00
fi
fi
2009-12-20 07:33:29 +08:00
2010-01-08 01:52:48 +08:00
rm -rf /tmp/t
if [ -d /var/log/bigbluebutton ]; then
2010-03-09 23:32:20 +08:00
if [ ! is_gentoo ]; then
sudo grep -i exception /var/log/bigbluebutton/* > /tmp/t
if [ -s /tmp/t ]; then
2010-01-08 01:52:48 +08:00
echo " -- Exceptions found in /var/log/bigbluebutton -- "
cat /tmp/t
echo
2010-03-09 23:32:20 +08:00
fi
2010-01-08 01:52:48 +08:00
fi
fi
2009-11-04 08:33:36 +08:00
exit 0
fi
# if asked to print the version that's all we do
2009-11-05 12:08:22 +08:00
if [ -n "$HOST" ]; then
2009-11-04 08:33:36 +08:00
#
# Just use the IP for port test in /var/www/bigbluebutton/client/conf/config.xml
#
echo "Assigning $HOST for testing for firewall in /var/www/bigbluebutton/client/conf/config.xml"
sudo sed -i "s/porttest host=\(\"[^\"]*\"\)/porttest host=\"$HOST\"/g" /var/www/bigbluebutton/client/conf/config.xml
2010-09-20 09:47:17 +08:00
2009-11-04 08:33:36 +08:00
echo "Assigning $HOST for rtmp:// in /var/www/bigbluebutton/client/conf/config.xml"
sudo sed -i "s/rtmp:\/\/\([^\"\/]*\)\([\"\/]\)/rtmp:\/\/$HOST\2/g" /var/www/bigbluebutton/client/conf/config.xml
echo "Assigning $HOST for servername in /etc/nginx/sites-available/bigbluebutton"
sudo sed -i "s/server_name .*/server_name $HOST;/g" /etc/nginx/sites-available/bigbluebutton
#
# Use port for remaining substitutions
#
if [ $PORT ]; then
HOST="$HOST:$PORT"
fi
#
# Update configuration for BigBlueButton client
#
echo "Assigning $HOST for http:// in /var/www/bigbluebutton/client/conf/config.xml"
sudo sed -i "s/http:\/\/\([^\"\/]*\)\([\"\/]\)/http:\/\/$HOST\2/g" /var/www/bigbluebutton/client/conf/config.xml
#
# Update configuration for BigBlueButton web app
#
2010-03-09 23:32:20 +08:00
echo "Assigning $HOST for web application URL in /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties"
2009-11-04 08:33:36 +08:00
sudo sed -i "s/bigbluebutton.web.serverURL=http:\/\/.*/bigbluebutton.web.serverURL=http:\/\/$HOST/g" \
2010-03-09 23:32:20 +08:00
/var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
2009-11-04 08:33:36 +08:00
2010-10-04 11:27:23 +08:00
# 3 paramenter: the file, the variable name, the new value
# echo "Assigning $HOST for FreeSWITCH Event Socket Layer URL in /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties"
# change_var_ip /usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties esl.host $HOST
2010-08-10 23:09:16 +08:00
2010-03-09 23:32:20 +08:00
# cat /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
2009-11-04 08:33:36 +08:00
#
# Update nginx
#
if [ $PORT ]; then
echo "Assigning $PORT for listen in /etc/nginx/sites-available/bigbluebutton"
sudo sed -i "s/listen .*/listen $PORT;/g" /etc/nginx/sites-available/bigbluebutton
fi
if ! grep -q server_names_hash_bucket_size /etc/nginx/nginx.conf; then
sudo sed -i "s/gzip on;/gzip on;\n server_names_hash_bucket_size 64;/g" /etc/nginx/nginx.conf
fi
2009-12-24 11:02:55 +08:00
#
# Update api demos
#
2010-03-09 23:32:20 +08:00
if [ -f /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp ]; then
echo "Assigning $HOST for api demos in /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp"
2009-12-31 04:53:15 +08:00
sudo sed -i "s/BigBlueButtonURL = \"http:\/\/\([^\"\/]*\)\([\"\/]\)/BigBlueButtonURL = \"http:\/\/$HOST\2/g" \
2010-03-09 23:32:20 +08:00
/var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp
2009-12-24 11:02:55 +08:00
fi
2010-08-27 02:27:19 +08:00
#
# Update Freeswitch config
#
2010-09-20 09:47:17 +08:00
# Not needed -- we can keep this at 127.0.0.1
#
#HOSTIP=$(ifconfig | grep -v '127.0.0.1' | grep -m 1 'inet addr:' | cut -d: -f2 | awk '{ print $1}');
#if [ -f /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml ]; then
# EVENTIP=$(cat /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml | grep 'name="listen-ip"' | cut -d\" -f4 | awk '{print $1}')
# sed -i "s/$EVENTIP/$HOSTIP/g" \
# /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml
#fi
2010-08-27 02:27:19 +08:00
2010-08-27 02:38:40 +08:00
#
# Update bigbluebutton-sip.properties
#
2010-09-20 09:47:17 +08:00
# Not needed -- we can keep this at 127.0.0.1
#
#SIPIP=$(cat /usr/share/red5/webapps/sip/WEB-INF/bigbluebutton-sip.properties | grep 'sip.server.host' | cut -d= -f2)
#if [ -f /usr/share/red5/webapps/sip/WEB-INF/bigbluebutton-sip.properties ]; then
# sed -i "s/$SIPIP/$HOSTIP/g" \
# /usr/share/red5/webapps/sip/WEB-INF/bigbluebutton-sip.properties
#fi
2009-12-24 11:02:55 +08:00
2010-08-27 03:25:34 +08:00
echo "Restarting the bigbluebutton server ..."
stop_bigbluebutton
echo
start_bigbluebutton
# echo "Restarting ${TOMCAT} and nginx ..."
# sudo /etc/init.d/${TOMCAT} restart > /tmp/result 2>&1;cat /tmp/result;rm /tmp/result
# sudo /etc/init.d/nginx restart
2009-11-04 08:33:36 +08:00
exit 0
fi
2009-12-12 05:20:34 +08:00
if [ $CONFERENCE ]; then
2010-01-16 22:28:53 +08:00
need_root
2010-07-07 22:57:20 +08:00
if [ ! -f $RED5_DIR/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml ]; then
echo "Error: Unable to find $RED5_DIR/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml"
2009-12-12 05:20:34 +08:00
exit 1
fi
if [ ! -f /etc/asterisk/bbb_extensions.conf ]; then
echo "Error: Unable to find /etc/asterisk/bbb_extensions.conf"
exit 1
fi
2010-08-23 21:49:54 +08:00
2010-08-26 01:01:15 +08:00
if [ "$CONFERENCE" = "freeswitch" ]; then
2010-08-23 21:49:54 +08:00
CONFERENCE=freeswitch
elif [ "$CONFERENCE" = "meetme" ]; then
2009-12-12 05:20:34 +08:00
CONFERENCE=meetme
2010-08-23 21:49:54 +08:00
else
2010-01-16 22:28:53 +08:00
if [ "$CONFERENCE" = "konference" ]; then
2009-12-13 22:34:01 +08:00
CONFERENCE=app_konference
2009-12-12 05:20:34 +08:00
else
2010-08-23 21:49:54 +08:00
echo "Error: Valid options for --conference are: meetme, konference, freeswitch"
2010-02-09 05:22:16 +08:00
exit 1
2009-12-12 05:20:34 +08:00
fi
fi
if [ $CONFERENCE = "meetme" ]; then
2010-01-16 22:28:53 +08:00
#
2010-07-07 22:57:20 +08:00
# update $RED5_DIR/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
2010-01-16 22:28:53 +08:00
#
2010-08-26 01:53:25 +08:00
# test this as a hack to check if the ip stays in listen-ip for event-conf.xml
2010-09-20 09:47:17 +08:00
# -- XXX
# EVENTIP=$(sudo cat /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml | grep 'name="listen-ip"' | cut -d\" -f4 | awk '{print $1}')
2010-08-26 01:53:25 +08:00
2010-01-16 22:28:53 +08:00
sudo sed -i "s/asterisk.application[ ]*=.*/asterisk.application=meetme/g" \
2010-07-07 22:57:20 +08:00
$RED5_DIR/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
2009-12-12 05:20:34 +08:00
2010-01-21 04:53:47 +08:00
#
# update /etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/^exten => _XXXX.,n,Konference(\${EXTEN},H)/; exten => _XXXX.,n,Konference(\${EXTEN},H)/g" \
2010-01-21 04:53:47 +08:00
/etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/;[ ]*exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/g" \
2010-01-21 04:53:47 +08:00
/etc/asterisk/bbb_extensions.conf
2009-12-12 05:20:34 +08:00
2010-01-16 22:28:53 +08:00
#
# update /etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/; exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
2009-12-12 05:20:34 +08:00
/etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/^exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/; exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
2009-12-12 05:20:34 +08:00
/etc/asterisk/bbb_extensions.conf
2010-08-23 21:49:54 +08:00
echo "Switching to $CONFERENCE ... "
sudo /etc/init.d/asterisk restart
sudo /etc/init.d/red5 restart
2009-12-12 05:20:34 +08:00
fi
2009-12-13 22:34:01 +08:00
if [ $CONFERENCE = "app_konference" ]; then
2010-01-16 22:28:53 +08:00
#
2010-07-07 22:57:20 +08:00
# update $RED5_DIR/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
2010-01-16 22:28:53 +08:00
#
2010-09-20 09:47:17 +08:00
# EVENTIP=$(cat /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml | grep 'name="listen-ip"' | cut -d\" -f4 | awk '{print $1}')
# sed -i 's/$EVENTIP/$HOST/g' \
# /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml
2010-08-26 01:53:25 +08:00
2010-01-16 22:28:53 +08:00
sudo sed -i "s/asterisk.application[ ]*=.*/asterisk.application=konference/g" \
2010-07-07 22:57:20 +08:00
$RED5_DIR/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
2009-12-12 05:20:34 +08:00
2010-01-21 04:53:47 +08:00
#
# update /etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/;[ ]*exten => _XXXX.,n,Konference(\${EXTEN},H)/exten => _XXXX.,n,Konference(\${EXTEN},H)/g" \
2010-01-21 04:53:47 +08:00
/etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/^exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/; exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/g" \
2010-01-21 04:53:47 +08:00
/etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/^exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/; exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
2009-12-12 05:20:34 +08:00
/etc/asterisk/bbb_extensions.conf
2010-07-01 03:50:31 +08:00
sudo sed -i "s/; exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
2009-12-12 05:20:34 +08:00
/etc/asterisk/bbb_extensions.conf
2010-08-23 21:49:54 +08:00
if [ -f /usr/share/red5/webapps/bigbluebutton/WEB-INF/red5-web.xml ]; then
sudo sed -i 's/<import resource="bbb-voice-freeswitch.xml"\(.*\)\/>/<import resource="bbb-voice-asterisk.xml"\1\/>/g' \
/usr/share/red5/webapps/bigbluebutton/WEB-INF/red5-web.xml
fi
echo "Switching to $CONFERENCE ... "
2010-08-26 01:03:37 +08:00
sudo /etc/init.d/freeswitch stop
2010-09-20 09:47:17 +08:00
sudo update-rc.d freeswitch remove >/dev/null
update-rc.d asterisk defaults >/dev/null
2010-08-23 21:49:54 +08:00
sudo /etc/init.d/asterisk restart
sudo /etc/init.d/red5 restart
2009-12-12 05:20:34 +08:00
fi
2010-08-23 21:49:54 +08:00
if [ $CONFERENCE = "freeswitch" ]; then
# check if freeswitch is installed
if [ ! -d /opt/freeswitch ]; then
2010-09-20 09:47:17 +08:00
echo "Freeswitch is not installed"
2010-08-23 21:49:54 +08:00
exit 1;
fi
# switch the red5-web.xml from asterisk to freeswitch
if [ -f /usr/share/red5/webapps/bigbluebutton/WEB-INF/red5-web.xml ]; then
sudo sed -i 's/<import resource="bbb-voice-asterisk.xml"\(.*\)\/>/<import resource="bbb-voice-freeswitch.xml"\1\/>/g' \
/usr/share/red5/webapps/bigbluebutton/WEB-INF/red5-web.xml
fi
if [ -f /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml ]; then
2010-08-26 01:53:25 +08:00
EVENTIP=$(cat /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml | grep 'name="listen-ip"' | cut -d\" -f4 | awk '{print $1}')
2010-09-20 09:47:17 +08:00
sed -i "s/$EVENTIP/$IP/g" \
2010-08-23 21:49:54 +08:00
/opt/freeswitch/conf/autoload_configs/event_socket.conf.xml
fi
echo "Switching to $CONFERENCE ... "
sudo /etc/init.d/asterisk stop
2010-09-20 09:47:17 +08:00
sudo update-rc.d asterisk remove >/dev/null
update-rc.d freeswitch defaults >/dev/null
2010-08-23 21:49:54 +08:00
sudo /etc/init.d/freeswitch start
sudo /etc/init.d/red5 restart
fi
# echo "Switching to $CONFERENCE ... "
# sudo /etc/init.d/asterisk restart
# sudo /etc/init.d/red5 restart
2009-12-12 05:20:34 +08:00
fi
2010-03-25 21:55:39 +08:00
if [ $RESTART ]; then
need_root
echo "Restarting BigBlueButton ..."
stop_bigbluebutton
echo
display_bigbluebutton_status
echo
start_bigbluebutton
fi
2009-12-13 01:56:14 +08:00
if [ $CLEAN ]; then
need_root
2010-03-09 23:32:20 +08:00
2010-01-06 07:57:22 +08:00
echo "Doing a clean restart of BigBlueButton ..."
2009-12-13 22:34:01 +08:00
2010-03-25 21:55:39 +08:00
stop_bigbluebutton
2009-12-13 01:56:14 +08:00
#
# Clean log files
#
echo
2010-01-06 07:57:22 +08:00
echo "Cleaning Log Files ..."
2009-12-13 22:42:44 +08:00
rm -f /var/log/asterisk/event*
rm -f /var/log/asterisk/messages*
rm -f /var/log/asterisk/queue*
2010-09-15 23:02:41 +08:00
rm -f /var/log/bigbluebutton/bbb-web.log*
2010-03-09 23:32:20 +08:00
2010-07-07 22:57:20 +08:00
if [ $RED5_DIR ]; then
rm -rf $RED5_DIR/log/*
2010-03-09 23:32:20 +08:00
fi
if [ $TOMCAT6_LOGS ]; then
rm -rf $TOMCAT6_LOGS/*
fi
2009-12-13 01:56:14 +08:00
rm -rf /var/log/nginx/*
2009-12-20 07:33:29 +08:00
mv /var/log/syslog /tmp/syslog.$$
echo "" > /var/log/syslog
2009-12-13 01:56:14 +08:00
2010-03-25 21:55:39 +08:00
display_bigbluebutton_status
2009-12-14 02:11:05 +08:00
2009-12-13 22:34:01 +08:00
echo
2010-03-25 21:55:39 +08:00
start_bigbluebutton
2009-12-13 01:56:14 +08:00
fi
2009-12-13 22:34:01 +08:00
if [ $NETWORK ]; then
2009-12-14 02:11:05 +08:00
netstat -ant | egrep ":1935|:9123|:80\ " | egrep -v ":::|0.0.0.0" > /tmp/t_net
2009-12-13 22:34:01 +08:00
REMOTE=$(cat /tmp/t_net | cut -c 45-68 | cut -d ":" -f1 | sort | uniq)
if [ "$REMOTE" != "" ]; then
2009-12-14 02:11:05 +08:00
echo -e "netstat\t\t\t80\t1935\t9123"
2009-12-13 22:34:01 +08:00
for IP in $REMOTE ; do
2009-12-14 02:11:05 +08:00
PORT_1935=$(cat /tmp/t_net | grep :1935 | cut -c 45-68 | cut -d ":" -f1 | grep $IP | wc -l)
PORT_9123=$(cat /tmp/t_net | grep :9123 | cut -c 45-68 | cut -d ":" -f1 | grep $IP | wc -l )
PORT_80=$(cat /tmp/t_net | grep :80 | cut -c 45-68 | cut -d ":" -f1 | grep $IP | wc -l )
#if cat /tmp/t_net | grep 9123 | cut -c 45-68 | cut -d ":" -f1 | grep $IP > /dev/null; then
# DESKSHARE=" XXX"
#fi
echo -e "$IP\t\t$PORT_80\t$PORT_1935\t$PORT_9123"
2009-12-13 22:34:01 +08:00
done
fi
fi
2009-12-13 01:56:14 +08:00
if [ $WATCH ]; then
need_root
2010-01-02 10:17:11 +08:00
watch -n 2 "top -n 1 -b | head -n 5; echo; asterisk -r -x \"core show channels\"; echo; bbb-conf --network; bbb-conf --debug"
2009-12-13 01:56:14 +08:00
fi
2010-09-20 09:47:17 +08:00