2009-11-04 08:33:36 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# 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-11-04 08:33:36 +08:00
|
|
|
|
|
|
|
|
2009-12-12 05:20:34 +08:00
|
|
|
#set -x
|
2009-11-04 08:33:36 +08:00
|
|
|
|
2009-11-06 04:57:56 +08:00
|
|
|
print_header() {
|
|
|
|
if [ ! $HEADER ]; then
|
|
|
|
echo
|
2009-11-06 06:48:31 +08:00
|
|
|
echo "** Potential Problems **"
|
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
|
|
|
|
echo "This opearation should not be run as root."
|
|
|
|
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
|
|
|
|
echo "Need to be root to run this application"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-12-10 06:49:49 +08:00
|
|
|
usage() {
|
2009-11-04 08:33:36 +08:00
|
|
|
echo "$0 [options] [<file>]"
|
|
|
|
echo
|
|
|
|
echo "Options:"
|
|
|
|
echo " --help This message"
|
|
|
|
echo " --version Display BigBlueButton version"
|
2009-12-10 06:49:49 +08:00
|
|
|
echo " --check Check current settings"
|
|
|
|
echo " --debug Check the log files for errors"
|
2009-11-04 08:33:36 +08:00
|
|
|
echo
|
2009-11-05 12:08:22 +08:00
|
|
|
echo " --setip <host> Set IP/Hostname for BigBlueButton's configuration"
|
|
|
|
echo
|
|
|
|
echo " --setup-samba Setup samba share (VM only)"
|
|
|
|
echo " --setup-dev [bbb-web|bbb-client|bbb-apps] "
|
|
|
|
echo " Setup dev environment (VM only)"
|
2009-12-12 05:20:34 +08:00
|
|
|
echo "version: 0.62-1"
|
2009-11-04 08:33:36 +08:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
}
|
|
|
|
# comment lines matching $2 ($1 is the file)
|
|
|
|
comment () {
|
|
|
|
check_and_backup $1
|
|
|
|
sed -i "s<^[[:blank:]]*\(${2}.*\)<#\1<" $1
|
|
|
|
}
|
|
|
|
# comment lines matching $2 ($1 is the file)
|
|
|
|
uncomment () {
|
|
|
|
check_and_backup $1
|
|
|
|
sed -i "s<^[#[:blank:]]*\(${2}.*\)<\1<" $1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Parse the parameters
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
if [ "$1" = "-h" -o "$1" = "-help" -o "$1" = "?" -o "$1" = "--help" ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
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
|
2009-11-06 02:33:28 +08:00
|
|
|
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
|
|
|
|
|
2009-11-04 08:33:36 +08:00
|
|
|
#
|
|
|
|
# all other parameters requires at least 1 argument
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "-setip" -o "$1" = "--setip" ]; then
|
2009-11-05 12:08:22 +08:00
|
|
|
HOST="${2}"
|
2009-11-04 08:33:36 +08:00
|
|
|
shift; shift
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2009-11-04 23:35:48 +08:00
|
|
|
if [ "$1" = "--setup-dev" -o "$1" = "-setup-dev" ]; then
|
|
|
|
SETUPDEV="${2}"
|
|
|
|
shift; shift
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2009-12-12 05:20:34 +08:00
|
|
|
if [ "$1" = "--voice-conerence" -o "$1" = "-voice-conference" -o "$1" = "-vc" ]; then
|
|
|
|
CONFERENCE="${2}"
|
|
|
|
shift; shift
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2009-11-04 08:33:36 +08:00
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Version
|
|
|
|
#
|
|
|
|
if [ $VERSION ]; then
|
|
|
|
|
2009-11-06 02:33:28 +08:00
|
|
|
echo
|
2009-11-04 08:33:36 +08:00
|
|
|
dpkg -l | grep bbb
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-11-04 09:18:58 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Setup samba
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ $SAMBA ]; then
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
|
|
|
sudo /etc/init.d/samba restart
|
|
|
|
|
|
|
|
echo "
|
|
|
|
You can now access your development folder through:
|
|
|
|
|
|
|
|
\\\\$(hostname)\\$USER
|
|
|
|
|
|
|
|
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.
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ $SETUPDEV ]; then
|
|
|
|
check_root
|
|
|
|
|
2009-11-04 09:18:58 +08:00
|
|
|
if [ ! -d ~/dev ]; then
|
|
|
|
mkdir ~/dev
|
|
|
|
fi
|
|
|
|
|
2009-11-04 23:35:48 +08:00
|
|
|
if [ $SETUPDEV == "bbb-web" ]; then
|
|
|
|
if [ ! -d ~/dev/bbb-web ]; then
|
2009-11-04 08:33:36 +08:00
|
|
|
|
2009-11-04 10:23:54 +08:00
|
|
|
echo "# Setting up ~/dev/bbb-web"
|
2009-11-05 12:08:22 +08:00
|
|
|
echo " svn checkout http://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-web bbb-web"
|
2009-11-04 23:35:48 +08:00
|
|
|
|
2009-11-04 09:18:58 +08:00
|
|
|
cd ~/dev
|
|
|
|
svn checkout http://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-web bbb-web
|
2009-11-04 08:33:36 +08:00
|
|
|
|
|
|
|
IP="$(ifconfig eth0 | sed -n '/inet /{s/.*addr://;s/ .*//;p}')"
|
|
|
|
|
2009-11-05 12:08:22 +08:00
|
|
|
echo "# Setting IP address $IP in ~/.grails/bigbluebutton-config.properties"
|
2009-11-04 08:33:36 +08:00
|
|
|
mkdir -p ~/.grails
|
|
|
|
echo "bigbluebutton.web.serverURL=http://$IP" > ~/.grails/bigbluebutton-config.properties
|
|
|
|
|
2009-11-05 12:08:22 +08:00
|
|
|
echo "# Enabling $USER to write to /var/bigbluebutton to upload slides"
|
2009-11-07 00:15:45 +08:00
|
|
|
sudo chmod -R ugo+rwx /var/bigbluebutton
|
2009-11-04 08:33:36 +08:00
|
|
|
|
2009-11-06 02:33:28 +08:00
|
|
|
echo "
|
|
|
|
# Done. To run your local build of bbb-web:
|
|
|
|
|
|
|
|
sudo /etc/init.d/tomcat6 stop
|
|
|
|
cd ~/dev/bbb-web
|
|
|
|
ant
|
|
|
|
"
|
2009-11-04 23:35:48 +08:00
|
|
|
fi
|
|
|
|
fi
|
2009-11-04 09:18:58 +08:00
|
|
|
|
2009-11-04 23:35:48 +08:00
|
|
|
if [ $SETUPDEV == "bbb-client" ]; then
|
|
|
|
if [ ! -d ~/dev/bbb-client ]; then
|
2009-11-04 09:18:58 +08:00
|
|
|
|
2009-11-04 10:23:54 +08:00
|
|
|
echo "# Setting up ~/dev/bbb-client"
|
2009-11-05 12:08:22 +08:00
|
|
|
echo " svn checkout http://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-client bbb-client"
|
2009-11-04 10:23:54 +08:00
|
|
|
|
2009-11-04 09:18:58 +08:00
|
|
|
cd ~/dev
|
|
|
|
svn checkout http://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-client bbb-client
|
|
|
|
|
2009-11-04 10:23:54 +08:00
|
|
|
#
|
|
|
|
# Setup the directories so we can point /etc/nginx/sites-available/bigbluebutton to this
|
|
|
|
# local copy of the client
|
|
|
|
#
|
2009-11-04 09:18:58 +08:00
|
|
|
if [ ! -d ~/dev/bbb-client/bin ]; then
|
|
|
|
mkdir -p ~/dev/bbb-client/bin
|
|
|
|
fi
|
|
|
|
|
2009-11-04 10:23:54 +08:00
|
|
|
if [ ! -d ~/dev/bbb-client/bin/conf ]; then
|
|
|
|
mkdir -p ~/dev/bbb-client/bin/conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -h ~/dev/bbb-client/client ]; then
|
|
|
|
ln -s ~/dev/bbb-client/bin ~/dev/bbb-client/client
|
|
|
|
fi
|
|
|
|
|
2009-11-04 09:18:58 +08:00
|
|
|
echo "Modifying /etc/nginx/sites-available/bigbluebutton to point to your local copy of bbb-client"
|
2009-11-04 10:23:54 +08:00
|
|
|
sudo sed -i "s/\/var\/www\/bigbluebutton;/\/home\/firstuser\/dev\/bbb-client;/g" \
|
2009-11-04 09:18:58 +08:00
|
|
|
/etc/nginx/sites-available/bigbluebutton
|
|
|
|
sudo /etc/init.d/nginx restart
|
|
|
|
|
2009-11-04 10:23:54 +08:00
|
|
|
echo "# Copying /var/www/bigbluebutton/client/conf/config.xml to ~/dev/bbb-client/bin/conf/config.xml"
|
|
|
|
cp /var/www/bigbluebutton/client/conf/config.xml ~/dev/bbb-client/bin/conf/config.xml
|
|
|
|
|
2009-11-05 12:08:22 +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
|
|
|
|
2009-11-06 02:33:28 +08:00
|
|
|
cd ~/dev/bbb-client
|
2009-11-05 12:08:22 +08:00
|
|
|
ant
|
2009-11-06 02:33:28 +08:00
|
|
|
|
|
|
|
# The nginx server now loads the BigBlueButton Flash client from
|
|
|
|
# /home/firstuser/dev/bbb-client.
|
2009-11-05 12:08:22 +08:00
|
|
|
"
|
2009-11-04 23:35:48 +08:00
|
|
|
fi
|
2009-11-04 10:23:54 +08:00
|
|
|
fi
|
|
|
|
|
2009-11-05 12:08:22 +08:00
|
|
|
if [ $SETUPDEV == "bbb-apps" ]; then
|
|
|
|
if [ ! -d ~/dev/bbb-apps ]; then
|
|
|
|
|
|
|
|
echo "# Setting up ~/dev/bbb-apps:"
|
|
|
|
echo " svn checkout http://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-apps bbb-apps"
|
|
|
|
|
|
|
|
cd ~/dev
|
|
|
|
svn checkout http://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-apps bbb-apps
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# We're going to make it easier to deploy by giving write access to others to
|
|
|
|
# /usr/share/red5/webapps
|
|
|
|
#
|
|
|
|
sudo chmod o+w /usr/share/red5/webapps
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
|
|
|
if [ ! -f ~/.bbb-apps-build.properties ]; then
|
|
|
|
echo "#
|
|
|
|
# Override the default properties for bbb-apps
|
|
|
|
#
|
|
|
|
red5.home = /usr/share/red5
|
|
|
|
" > ~/.bbb-apps-build.properties
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Setup the directories so we can point /etc/nginx/sites-available/bigbluebutton to this
|
|
|
|
# local copy of the client
|
|
|
|
#
|
|
|
|
echo "
|
|
|
|
# Done. To run your local build of bbb-apps:
|
|
|
|
|
|
|
|
sudo /etc/init.d/red5 stop
|
|
|
|
cd ~/dev/bbb-apps
|
|
|
|
ant deploy
|
|
|
|
sudo -u red5 /usr/share/red5/red5.sh
|
|
|
|
|
|
|
|
# To restore the packaged version of bbb-apps:
|
|
|
|
|
|
|
|
rm -rf /usr/share/red5/webapps/bigbluebutton
|
|
|
|
sudo apt-get install bbb-apps
|
|
|
|
sudo /etc/init.d/red5 start
|
|
|
|
"
|
|
|
|
|
|
|
|
fi
|
2009-11-04 08:33:36 +08:00
|
|
|
fi
|
|
|
|
|
2009-12-10 06:49:49 +08:00
|
|
|
check_processes() {
|
2009-11-05 12:08:22 +08:00
|
|
|
|
2009-11-06 06:48:31 +08:00
|
|
|
#
|
|
|
|
# Check for potential problems
|
|
|
|
#
|
|
|
|
|
2009-11-06 04:57:56 +08:00
|
|
|
if ! ps aux | grep '[/]usr/share/activemq' > /dev/null; then
|
|
|
|
print_header
|
|
|
|
echo " activeMQ: -- not running --"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! ps aux | grep 'org.red5.server.Bootstrap' > /dev/null; then
|
|
|
|
print_header
|
|
|
|
echo " red5: -- not running --"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! ps aux | grep '[/]usr/sbin/asterisk' > /dev/null; then
|
|
|
|
print_header
|
|
|
|
echo " asterisk: -- not running --"
|
|
|
|
fi
|
|
|
|
|
2009-11-06 07:14:17 +08:00
|
|
|
if ! ps aux | grep '[/]usr/sbin/nginx' > /dev/null; then
|
|
|
|
print_header
|
|
|
|
echo " ngingx: -- not running --"
|
|
|
|
fi
|
|
|
|
|
2009-11-06 04:57:56 +08:00
|
|
|
if ! netstat -ant | grep '8080' > /dev/null; then
|
|
|
|
print_header
|
|
|
|
echo " tomcat6: -- not running --"
|
2009-12-12 05:20:34 +08:00
|
|
|
else
|
|
|
|
if ps aux | ps -aef | grep grails | grep run-app > /dev/null; then
|
|
|
|
print_header
|
|
|
|
echo " tomcat6: noticed you are running grails run-app instead of tomcat"
|
|
|
|
fi
|
|
|
|
fi
|
2009-11-06 04:57:56 +08:00
|
|
|
|
|
|
|
if [ ! -L /etc/nginx/sites-enabled/bigbluebutton ]; then
|
|
|
|
print_header
|
|
|
|
echo " nginx (conf): no symbolic link in /etc/nginx/sites-enabled for bigbluebutton"
|
|
|
|
fi
|
|
|
|
|
2009-12-12 05:20:34 +08:00
|
|
|
if grep /home/firstuser/dev/bbb-client /etc/nginx/sites-available/bigbluebutton > /dev/null; then
|
|
|
|
print_header
|
|
|
|
echo " nginx (conf): noticed that location for cient is /home/firstuser/dev/bbb-client"
|
|
|
|
echo " instead of the usual /var/www/bigbluebutton"
|
|
|
|
fi
|
|
|
|
|
2009-11-06 06:48:31 +08:00
|
|
|
DIRECTORIES="bigbluebutton sip video"
|
|
|
|
for dir in $DIRECTORIES ; do
|
|
|
|
if [ ! -d /usr/share/red5/webapps/$dir ]; then
|
|
|
|
echo " missing red5 app: /usr/share/red5/webapps/$dir "
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
RED5_LOG_FILES="bigbluebutton oflademo red5 sip video"
|
|
|
|
for file in $RED5_LOG_FILES ; do
|
|
|
|
if [ ! -f /usr/share/red5/log/$file.log ]; then
|
|
|
|
echo " missing red5 log: /usr/share/red5/log/$file.demo"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
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
|
|
|
|
#
|
|
|
|
if [ $CHECK ]; then
|
|
|
|
|
|
|
|
echo "Current Configuration:"
|
|
|
|
|
|
|
|
IP=$(cat /var/www/bigbluebutton/client/conf/config.xml | sed -n '/porttest /{s/.*host="//;s/".*//;p}')
|
|
|
|
echo
|
|
|
|
echo "/var/www/bigbluebutton/client/conf/config.xml (bbb-client)"
|
|
|
|
echo " IP for tunnel check: $IP"
|
|
|
|
|
|
|
|
IP=$(cat /var/www/bigbluebutton/client/conf/config.xml | sed -n '/uri.*video/{s/.*rtmp:\/\///;s/\/.*//;p}')
|
|
|
|
echo " IP for rtmp (red5): $IP"
|
|
|
|
|
|
|
|
HOST=$(cat /var/www/bigbluebutton/client/conf/config.xml | sed -n '/recordingHost/{s/.*recordingHost="http:\/\///;s/"//;p}')
|
|
|
|
echo " host for bbb-web interface: $HOST"
|
|
|
|
|
|
|
|
IP=$(cat /etc/nginx/sites-available/bigbluebutton | sed -n '/server_name/{s/.*name[ ]*//;s/;//;p}')
|
|
|
|
echo
|
|
|
|
echo "/etc/nginx/sites-available/bigbluebutton (configuration file nginx)"
|
|
|
|
echo " server_name: $IP"
|
|
|
|
|
|
|
|
PORT=$(cat /etc/nginx/sites-available/bigbluebutton | sed -n '/listen/{s/.*listen[ ]*//;s/;//;p}')
|
|
|
|
echo " port: $PORT"
|
|
|
|
|
|
|
|
BBB_CLINET_DOC_ROOT=$(cat /etc/nginx/sites-available/bigbluebutton | grep \/client -A 1 | grep root | sed -n '{s/[ ]*root[ ]*//;s/;//;p}')
|
|
|
|
echo " client document root: $BBB_CLINET_DOC_ROOT"
|
|
|
|
|
|
|
|
HOST=$(cat /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | sed -n '/bigbluebutton.web.serverURL/{s/.*\///;p}')
|
|
|
|
echo
|
|
|
|
echo "/var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties (for bbb-web)"
|
|
|
|
echo " host: $HOST"
|
|
|
|
|
|
|
|
check_processes
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
rm -rf /tmp/t
|
|
|
|
grep ERROR /usr/share/red5/log/* > /tmp/t
|
|
|
|
if [ -s /tmp/t ]; then
|
|
|
|
echo " -- ERRORS found in /usr/share/red5/log/* -- "
|
|
|
|
cat /tmp/t
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
rm -rf /tmp/t
|
|
|
|
grep Exception /usr/share/red5/log/* > /tmp/t
|
|
|
|
if [ -s /tmp/t ]; then
|
|
|
|
echo " -- Exceptions found in /usr/share/red5/log/* -- "
|
|
|
|
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
|
2009-12-10 06:49:49 +08:00
|
|
|
sudo grep Exception /var/lib/tomcat6/logs/* > /tmp/t
|
2009-12-09 10:37:32 +08:00
|
|
|
if [ -s /tmp/t ]; then
|
|
|
|
echo " -- Exceptions found in /var/lib/tomcat6/logs/ -- "
|
|
|
|
cat /tmp/t
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
2009-12-12 05:20:34 +08:00
|
|
|
rm -rf /tmp/t
|
|
|
|
if [ -s /var/log/nginx/error.log ]; then
|
|
|
|
echo " -- Errors found in /var/log/nginx/error.log -- "
|
|
|
|
cat /var/log/nginx/error.log
|
|
|
|
echo
|
|
|
|
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
|
|
|
|
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
|
|
|
|
#
|
|
|
|
echo "Assigning $HOST for web application URL in /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties"
|
|
|
|
|
|
|
|
sudo sed -i "s/bigbluebutton.web.serverURL=http:\/\/.*/bigbluebutton.web.serverURL=http:\/\/$HOST/g" \
|
|
|
|
/var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
|
|
|
|
|
|
|
|
# cat /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
|
|
|
echo "Restarting tomcat6 and nginx ..."
|
|
|
|
sudo /etc/init.d/tomcat6 restart > /tmp/result 2>&1;cat /tmp/result;rm /tmp/result
|
|
|
|
sudo /etc/init.d/nginx restart
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-12-12 05:20:34 +08:00
|
|
|
if [ $CONFERENCE ]; then
|
|
|
|
if [ ! -f /usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml ]; then
|
|
|
|
echo "Error: Unable to find /usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f /etc/asterisk/bbb_extensions.conf ]; then
|
|
|
|
echo "Error: Unable to find /etc/asterisk/bbb_extensions.conf"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$CONFERENCE" = "m" ]; then
|
|
|
|
CONFERENCE=meetme
|
|
|
|
else
|
|
|
|
if [ "$CONFERENCE" = "k" ]; then
|
|
|
|
CONFERENCE=konference
|
|
|
|
else
|
|
|
|
echo "Error: Valid options are m (meetme) or k (konference)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $CONFERENCE = "meetme" ]; then
|
|
|
|
sudo sed -i "s/<beans:property name=\"conferenceApplication\" ref=\"konferenceApplication\"\/>/<\!--beans:property name=\"conferenceApplication\" ref=\"konferenceApplication\"\/-->/g" \
|
|
|
|
/usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml
|
|
|
|
|
|
|
|
sudo sed -i "s/<\!--beans:property name=\"conferenceApplication\" ref=\"meetMeApplicationFacade\"\/-->/<beans:property name=\"conferenceApplication\" ref=\"meetMeApplicationFacade\"\>/g" \
|
|
|
|
/usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml
|
|
|
|
|
|
|
|
sudo sed -i "s/# exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
|
|
|
|
/etc/asterisk/bbb_extensions.conf
|
|
|
|
|
|
|
|
sudo sed -i "s/exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/# exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
|
|
|
|
/etc/asterisk/bbb_extensions.conf
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $CONFERENCE = "konference" ]; then
|
|
|
|
sudo sed -i "s/<\!--beans:property name=\"conferenceApplication\" ref=\"konferenceApplication\"\/-->/<beans:property name=\"conferenceApplication\" ref=\"konferenceApplication\"\/>/g" \
|
|
|
|
/usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml
|
|
|
|
|
|
|
|
sudo sed -i "s/<beans:property name=\"conferenceApplication\" ref=\"meetMeApplicationFacade\"\>/<\!--beans:property name=\"conferenceApplication\" ref=\"meetMeApplicationFacade\"\/-->/g" \
|
|
|
|
/usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml
|
|
|
|
|
|
|
|
sudo sed -i "s/exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/# exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
|
|
|
|
/etc/asterisk/bbb_extensions.conf
|
|
|
|
|
|
|
|
sudo sed -i "s/# exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
|
|
|
|
/etc/asterisk/bbb_extensions.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Swtiching to $CONFERENCE ... "
|
|
|
|
sudo /etc/init.d/asterisk restart
|
|
|
|
sudo /etc/init.d/red5 restart
|
|
|
|
fi
|
|
|
|
|