2020-06-23 23:01:26 +08:00
#!/bin/bash
2017-02-21 03:11:22 +08:00
#
2020-12-19 07:38:46 +08:00
# BlueButton open source conferencing system - https://www.bigbluebutton.org/
2017-02-21 03:11:22 +08:00
#
2020-12-19 07:38:46 +08:00
# Copyright (c) 2020 BigBlueButton Inc. and by respective authors (see below).
2017-02-21 03:11:22 +08:00
#
# This program 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.0 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
2020-12-19 07:38:46 +08:00
# with BigBlueButton; if not, see <https://www.gnu.org/licenses/>.
2017-02-21 03:11:22 +08:00
#
# Author(s):
2019-03-14 22:19:13 +08:00
# Fred Dixon <ffdixon@bigbluebutton.org>
# Sebastian Schneider <seb.sschneider@gmail.com>
# Ghazi Triki <ghazi.nocturne@gmail.com>
2017-02-21 03:11:22 +08:00
#
# Changelog:
2019-03-14 22:19:13 +08:00
# 2009-10-18 FFD Initial Version
# 2009-11-05 FFD Updated for 0.62
# 2009-12-09 FFD Updated for 0.63
# 2009-12-11 FFD Added ability to switch conference servers
# 2009-12-12 FFD Added cleaning and watching of log files
# 2010-01-05 FFD Added zipping of log files
# 2010-01-18 FFD Added resetting of environment back to using packages
# 2010-03-02 JRT Added trunk checkout options / fixed bbb-apps instructions
# 2010-04-02 FFD Updated for 0.64
2017-02-21 03:11:22 +08:00
# 2010-06-21 SEB Cleaned up some code / Updated for 0.70
2018-06-17 04:29:56 +08:00
# 2010-06-25 SEB Added ability to change the security secret
2017-02-21 03:11:22 +08:00
# 2010-06-30 SEB Added some extra error checking
# 2010-07-06 SEB Added more error checking and report messages
# 2010-09-15 FFD Updates for 0.71-dev
# 2010-10-16 FFD Updates for 0.71-beta
# 2010-11-06 FFD Added logic to ensure red5 shuts down
# 2010-12-12 FFD Fixed bug #778
# 2010-12-12 FFD Added support for Intalio VM
2019-03-14 22:19:13 +08:00
# 2010-02-28 FFD Fixed #834
2017-02-21 03:11:22 +08:00
# 2011-06-26 FFD Updates for 0.8
2019-03-14 22:19:13 +08:00
# 2012-01-14 FFD Testing the development environment for 0.8
2017-02-21 03:11:22 +08:00
# 2012-02-22 FFD Updates to development environment
# 2012-04-27 FFD Added sum of version numbers in --check
# 2013-02-03 FFD Updated for changes to parameters for 0.81 in bigbluebutton-sip.properties
# 2013-11-07 FFD Finished 0.81
2019-03-14 22:19:13 +08:00
# 2014-01-13 FFD Working on updates for 0.9.0
# 2014-03-10 GUG Enable WebRTC
2017-02-21 03:11:22 +08:00
# 2015-03-12 FFD Added start/stop of HTML5 server
# 2016-01-13 FFD Updates for 1.0
# 2016-02-28 FFD Updates to support HTTPS configuration
# 2016-05-28 FFD Initial updates for 1.1-dev
# 2016-08-15 GTR Archive more logs with zip option and show more applications with status
# 2016-10-17 GTR Added redis to checked server components & added ownership check for video and freeswitch recording directories
2017-04-09 06:41:20 +08:00
# 2017-04-08 FFD Cleanup for 1.1-beta
2018-11-23 02:13:46 +08:00
# 2018-11-22 MNE Dynamically detect if sudo is needed
2018-12-10 04:47:13 +08:00
# 2018-12-09 GTR More logs cleanup
2019-02-09 00:53:57 +08:00
# 2019-02-08 GTR Updates for 2.2 after extracting bbb-web to a standalone server application
2019-05-15 06:57:45 +08:00
# 2019-03-14 FFD Refactoring and cleanup for 2.2
# 2019-05-14 FFD Added more checks for configuration issues
2019-07-11 18:47:30 +08:00
# 2019-07-08 GTR Set IP for all recording formats
2019-11-01 00:14:24 +08:00
# 2019-10-31 GTR Set IP and shared secret for bbb-webhooks
2019-11-10 01:44:03 +08:00
# 2019-11-09 GTR Keep HTML5 client logs permissions when cleaning logs
2020-05-20 16:21:26 +08:00
# 2020-05-20 NJH Add port 443 to --Network and clean up tmp file.
2020-06-23 23:01:26 +08:00
# 2020-06-23 JFS Remove defaultGuestPolicy warning for HTML5 client
2021-05-30 21:40:36 +08:00
# 2020-10-22 AGG Removing Flash/Red5 related code (yay!)
2021-07-19 22:02:58 +08:00
# 2021-07-16 JFS Add defaultMeetingLayout information
2009-11-04 08:33:36 +08:00
2017-02-21 03:11:22 +08:00
#set -x
#set -e
2009-11-04 08:33:36 +08:00
2017-02-21 03:11:22 +08:00
PATH=$PATH:/sbin
2010-12-13 09:12:22 +08:00
2019-03-14 22:19:13 +08:00
if [[ "$(id -u)" != "0" ]]; then
if [[ -x "$(which sudo)" ]]; then
SUDO="$(which sudo)"
else
echo "bbb-conf must be ran as root!" && exit 1
fi
2018-11-23 02:13:46 +08:00
fi
2019-03-14 22:19:13 +08:00
if [[ ! -f /etc/bigbluebutton/bigbluebutton-release ]]; then
echo
echo "# BigBlueButton does not appear to be installed. Could not"
echo "# locate: /etc/bigbluebutton/bigbluebutton-release"
echo
exit 1
2019-01-17 04:22:10 +08:00
fi
2019-03-14 22:19:13 +08:00
# Load the content of the file as variables
2017-02-21 03:11:22 +08:00
source /etc/bigbluebutton/bigbluebutton-release
2010-12-13 09:12:22 +08:00
2017-02-21 03:11:22 +08:00
#
2018-12-11 21:15:04 +08:00
# Figure out our environment (Debian vs. CentOS)
2017-02-21 03:11:22 +08:00
#
2014-03-12 09:31:56 +08:00
2021-03-28 03:12:03 +08:00
if [ -f /etc/centos-release ] || [ -f /etc/system-release ]; then
2019-03-14 22:19:13 +08:00
DISTRIB_ID=centos
2019-06-03 10:20:07 +08:00
TOMCAT_USER=tomcat
TOMCAT_DIR=/var/lib/$TOMCAT_USER
2019-03-14 22:19:13 +08:00
SERVLET_LOGS=/usr/share/tomcat/logs
REDIS_SERVICE=redis.service
2019-03-11 08:35:05 +08:00
else
2019-03-14 22:19:13 +08:00
. /etc/lsb-release # Get value for DISTRIB_ID
2022-03-15 03:04:23 +08:00
if [ "$DISTRIB_CODENAME" == "focal" ]; then
2022-03-15 04:38:31 +08:00
TOMCAT_USER=tomcat9
2019-11-18 03:01:10 +08:00
fi
2019-06-03 10:20:07 +08:00
TOMCAT_DIR=/var/lib/$TOMCAT_USER
2019-03-14 22:19:13 +08:00
SERVLET_LOGS=$TOMCAT_DIR/logs
REDIS_SERVICE=redis-server
2019-03-11 08:35:05 +08:00
fi
2019-03-14 22:19:13 +08:00
# Common to Ubuntu and CentOS
FREESWITCH_VARS=/opt/freeswitch/etc/freeswitch/vars.xml
FREESWITCH_EXTERNAL=/opt/freeswitch/etc/freeswitch/sip_profiles/external.xml
FREESWITCH_PID=/opt/freeswitch/var/run/freeswitch/freeswitch.pid
FREESWITCH_EVENT_SOCKET=/opt/freeswitch/etc/freeswitch/autoload_configs/event_socket.conf.xml
2022-05-28 01:02:12 +08:00
FREESWITCH_SWITCH_CONF=/opt/freeswitch/etc/freeswitch/autoload_configs/switch.conf.xml
2019-03-11 08:35:05 +08:00
2019-07-21 19:30:20 +08:00
LTI_DIR=/usr/share/bbb-lti
2019-02-09 00:53:57 +08:00
2019-02-11 01:48:17 +08:00
if [ -f /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties ]; then
2019-03-14 22:19:13 +08:00
SERVLET_DIR=/usr/share/bbb-web
2019-02-08 07:10:55 +08:00
fi
2014-03-12 09:31:56 +08:00
2021-02-23 19:48:26 +08:00
get_properties_value() {
key="$1"
file="$2"
if [[ -f $file ]]; then
val=$(grep "^$key" "$file"| cut -d = -f 2-)
echo "$val"
return 0
2019-03-14 22:19:13 +08:00
fi
2021-02-23 19:48:26 +08:00
return 1
}
get_bbb_web_config_value() {
key="$1"
val="$(get_properties_value "$key" "$BBB_WEB_ETC_CONFIG")"
if [[ -n $val ]]; then
echo "$val"
return 0
fi
val="$(get_properties_value "$key" "$BBB_WEB_CONFIG")"
if [[ -n $val ]]; then
echo "$val"
return 0
fi
return 1
}
2019-02-11 01:48:17 +08:00
RECORD_CONFIG=/usr/local/bigbluebutton/core/scripts/bigbluebutton.yml
2021-06-09 17:50:54 +08:00
HTML5_DEFAULT_CONFIG=/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml
HTML5_ETC_CONFIG=/etc/bigbluebutton/bbb-html5.yml
if [ -f $HTML5_ETC_CONFIG ]; then
HTML5_CONFIG=$(yq m -x $HTML5_DEFAULT_CONFIG $HTML5_ETC_CONFIG)
else
HTML5_CONFIG=$(yq r $HTML5_DEFAULT_CONFIG)
fi
2019-02-11 01:48:17 +08:00
2022-05-05 10:05:59 +08:00
WEBRTC_SFU_DEFAULT_CONFIG=/usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml
WEBRTC_SFU_ETC_CONFIG=/etc/bigbluebutton/bbb-webrtc-sfu/production.yml
if [ -f $WEBRTC_SFU_ETC_CONFIG ]; then
2022-05-05 10:06:55 +08:00
# -a overwrite: merges arrays by replacement (yq 3.4+, like the override)
WEBRTC_SFU_CONFIG=$(yq m -a overwrite -x $WEBRTC_SFU_DEFAULT_CONFIG $WEBRTC_SFU_ETC_CONFIG)
2021-06-09 17:50:54 +08:00
else
2022-05-05 10:05:59 +08:00
WEBRTC_SFU_CONFIG=$(yq r $WEBRTC_SFU_DEFAULT_CONFIG)
2021-06-09 17:50:54 +08:00
fi
2019-02-11 01:48:17 +08:00
2019-03-14 22:19:13 +08:00
BBB_WEB_CONFIG="$SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties"
2021-02-23 19:48:26 +08:00
BBB_WEB_ETC_CONFIG="/etc/bigbluebutton/bbb-web.properties"
2019-03-09 06:39:30 +08:00
NGINX_IP=$(cat /etc/nginx/sites-available/bigbluebutton | grep -v '#' | sed -n '/server_name/{s/.*server_name[ ]*//;s/;//;p}' | cut -d' ' -f1 | head -n 1)
2022-03-15 10:01:37 +08:00
SIP_CONFIG=/usr/share/bigbluebutton/nginx/sip.nginx
2019-03-10 08:11:30 +08:00
SIP_NGINX_IP=$(cat $SIP_CONFIG | grep -v '#' | sed -n '/proxy_pass/{s/.*proxy_pass http[s]*:\/\///;s/:.*//;p}' | head -n 1)
2019-03-14 22:19:13 +08:00
NCPU=$(nproc --all)
2018-08-25 03:02:51 +08:00
2019-02-09 00:53:57 +08:00
BBB_USER=bigbluebutton
2023-02-27 03:32:24 +08:00
if [ $EUID == 0 ]; then
TURN=$SERVLET_DIR/WEB-INF/classes/spring/turn-stun-servers.xml
TURN_ETC_CONFIG=/etc/bigbluebutton/turn-stun-servers.xml
if [ -f "$TURN_ETC_CONFIG" ]; then
2021-04-08 04:44:27 +08:00
TURN=$TURN_ETC_CONFIG
2023-02-27 03:32:24 +08:00
fi
STUN="$(xmlstarlet sel -N x="http://www.springframework.org/schema/beans" -t -m '_:beans/_:bean[@class="org.bigbluebutton.web.services.turn.StunTurnService"]/_:property[@name="stunServers"]/_:set/_:ref' -v @bean -nl $TURN)"
2021-04-08 04:44:27 +08:00
fi
2021-02-14 10:19:58 +08:00
2021-02-23 19:48:26 +08:00
PROTOCOL=http
if [ -f $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties ]; then
SERVER_URL=$(get_bbb_web_config_value bigbluebutton.web.serverURL | sed -n '{s/.*\///;p}')
if get_bbb_web_config_value bigbluebutton.web.serverURL | grep -q https; then
PROTOCOL=https
fi
fi
2017-02-21 03:11:22 +08:00
#
2017-04-09 06:41:20 +08:00
# We're going to give ^bigbluebutton.web.logoutURL a default value (if undefined) so bbb-conf does not give a warning
2017-02-21 03:11:22 +08:00
#
2019-02-08 07:10:55 +08:00
if [ -f $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties ]; then
2021-05-02 22:33:08 +08:00
if [ -z "$(get_bbb_web_config_value bigbluebutton.web.logoutURL)" ]; then
echo "bigbluebutton.web.logoutURL=default" >> $BBB_WEB_ETC_CONFIG
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
fi
2014-03-13 09:04:58 +08:00
2017-02-21 03:11:22 +08:00
#
# Determine IP so it works on multilingual installations
#
2014-09-18 05:37:43 +08:00
2022-03-21 07:44:51 +08:00
### duplicated code: see deb-helper.sh and apply-lib.sh
if [ -e "/sys/class/net/venet0:0" ]; then
# IP detection for OpenVZ environment
_dev="venet0:0"
2017-02-21 03:11:22 +08:00
else
2022-03-21 07:44:51 +08:00
_dev=$(awk '$2 == 00000000 { print $1 }' /proc/net/route | head -1)
2017-02-21 03:11:22 +08:00
fi
2022-03-21 07:44:51 +08:00
_ips=$(LANG=C ip -4 -br address show dev "$_dev" | awk '{ $1=$2=""; print $0 }')
_ips=${_ips/127.0.0.1\/8/}
read -r IP _ <<< "$_ips"
IP=${IP/\/*} # strip subnet provided by ip address
2017-08-17 23:55:05 +08:00
if [ -z "$IP" ]; then
2022-03-21 07:44:51 +08:00
read -r IP _ <<< "$(hostname -I)"
2017-08-17 23:55:05 +08:00
fi
2017-04-09 06:41:20 +08:00
#
# Calculate total memory on this server
#
2019-03-14 22:19:13 +08:00
MEM=$(grep MemTotal /proc/meminfo | awk '{print $2}')
2017-04-09 06:41:20 +08:00
MEM=$((MEM/1000))
2012-01-22 05:40:40 +08:00
2017-02-21 03:11:22 +08:00
#
# Check if the function has a value and, if not, print an error message
# $1 -- name of value
# $2 -- location of value
# $3 -- value to check
#
check_no_value() {
2019-03-14 22:19:13 +08:00
if [ -z $3 ]; then
echo "# Tried to check $1 in"
echo "# $2"
echo "# but value is empty."
exit 1
fi
2017-02-21 03:11:22 +08:00
}
2010-10-31 05:41:21 +08:00
2017-02-21 03:11:22 +08:00
check_file() {
2019-03-14 22:19:13 +08:00
if [ ! -f $1 ]; then
echo "# File does not exist: $1"
fi
2017-02-21 03:11:22 +08:00
}
2010-10-31 05:41:21 +08:00
2017-02-21 03:11:22 +08:00
print_header() {
2019-03-14 22:19:13 +08:00
if [ ! $HEADER ]; then
echo
2019-08-22 01:12:41 +08:00
echo "# Potential problems described below"
2019-03-14 22:19:13 +08:00
HEADER=1
fi
2017-02-21 03:11:22 +08:00
}
2009-11-04 08:33:36 +08:00
2017-02-21 03:11:22 +08:00
need_root() {
2019-03-14 22:19:13 +08:00
if [ $EUID != 0 ]; then
echo "Need to be root to run this option"
exit 1
fi
2017-02-21 03:11:22 +08:00
}
2009-12-12 05:20:34 +08:00
2012-01-16 09:20:24 +08:00
2017-02-21 03:11:22 +08:00
usage() {
2019-03-14 22:19:13 +08:00
echo "BigBlueButton Configuration Utility - Version $BIGBLUEBUTTON_RELEASE"
echo
echo " bbb-conf [options]"
echo
echo "Configuration:"
echo " --version Display BigBlueButton version (packages)"
echo " --setip <IP/hostname> Set IP/hostname for BigBlueButton"
2022-06-25 02:22:45 +08:00
echo " --setsecret <secret> Change the shared secret in /etc/bigbluebutton/bbb-web.properties"
2022-05-26 07:16:39 +08:00
echo " --set-port-range MIN-MAX Change UDP port range used for audio/video/screenshare"
2019-03-14 22:19:13 +08:00
echo
echo "Monitoring:"
echo " --check Check configuration files and processes for problems"
echo " --debug Scan the log files for error messages"
echo " --watch Scan the log files for error messages every 2 seconds"
2020-04-29 20:16:28 +08:00
echo " --network View network connections on 80, 443 and 1935 by IP address. 1935 is deprecated. You will need to modify bbb-conf if you have custom ports."
2019-03-14 22:19:13 +08:00
echo " --secret View the URL and shared secret for the server"
echo " --lti View the URL and secret for LTI (if installed)"
echo
echo "Administration:"
echo " --restart Restart BigBlueButton"
echo " --stop Stop BigBlueButton"
echo " --start Start BigBlueButton"
echo " --clean Restart and clean all log files"
echo " --status Display running status of components"
echo " --zip Zip up log files for reporting an error"
echo
2017-02-21 03:11:22 +08:00
}
2009-11-04 08:33:36 +08:00
2017-02-21 03:11:22 +08:00
# utility function to make a copy of the conf file
check_and_backup () {
2019-03-14 22:19:13 +08:00
# 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
2017-02-21 03:11:22 +08:00
}
# 3 paramenter: the file, the variable name, the new value
change_var_value () {
2019-03-14 22:19:13 +08:00
check_and_backup $1
sed -i "s<^[[:blank:]#]*\(${2}\).*<\1=${3}<" $1
2017-02-21 03:11:22 +08:00
}
# same as change_var_value but with quotes
change_var_salt() {
2019-03-14 22:19:13 +08:00
check_and_backup $1
sed -i "s<^[[:blank:]#]*\(${2}\).*<\1="${3}"<" $1
2017-02-21 03:11:22 +08:00
}
# comment lines matching $2 ($1 is the file)
comment () {
2019-03-14 22:19:13 +08:00
check_and_backup $1
sed -i "s<^[[:blank:]]*\(${2}.*\)<#\1<" $1
2017-02-21 03:11:22 +08:00
}
change_yml_value () {
2019-03-14 22:19:13 +08:00
sed -i "s<^\([[:blank:]#]*\)\(${2}\): .*<\1\2: ${3}<" $1
2017-02-21 03:11:22 +08:00
}
2018-10-23 04:27:46 +08:00
2017-02-21 03:11:22 +08:00
# comment lines matching $2 ($1 is the file)
uncomment () {
2019-03-14 22:19:13 +08:00
check_and_backup $1
sed -i "s<^[#[:blank:]]*\(${2}.*\)<\1<" $1
2017-02-21 03:11:22 +08:00
}
stop_bigbluebutton () {
echo "Stopping BigBlueButton"
2020-12-19 08:47:59 +08:00
if systemctl list-units --full -all | grep -q $TOMCAT_USER.service; then
2019-06-03 10:20:07 +08:00
TOMCAT_SERVICE=$TOMCAT_USER
2022-08-26 22:44:27 +08:00
systemctl stop $TOMCAT_SERVICE
2019-06-03 10:20:07 +08:00
fi
2022-08-26 22:44:27 +08:00
systemctl stop bigbluebutton.target
2017-02-21 03:11:22 +08:00
}
start_bigbluebutton () {
2019-03-14 22:19:13 +08:00
#
# Apply any local configuration options (if exists)
#
if [ -x /etc/bigbluebutton/bbb-conf/apply-config.sh ]; then
echo
echo "Applying updates in /etc/bigbluebutton/bbb-conf/apply-config.sh: "
/etc/bigbluebutton/bbb-conf/apply-config.sh
echo
fi
2019-02-11 14:23:10 +08:00
2019-03-14 22:19:13 +08:00
if [ -f /opt/freeswitch/var/log/freeswitch/freeswitch.log ]; then
if grep -q "Failure to connect to CORE_DB sofia_reg_external" /opt/freeswitch/var/log/freeswitch/freeswitch.log; then
2020-12-19 07:38:46 +08:00
# See: https://docs.bigbluebutton.org/install/install.html#freeswitch-fails-to-bind-to-ipv4
2019-03-14 22:19:13 +08:00
echo "Clearing the FreeSWITCH database."
rm -rf /opt/freeswitch/var/lib/freeswitch/db/*
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
2022-07-08 01:19:09 +08:00
echo "Reloading NginX configuration"
systemctl reload nginx
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
echo "Starting BigBlueButton"
2019-09-16 06:42:44 +08:00
2020-12-19 08:47:59 +08:00
if systemctl list-units --full -all | grep -q $TOMCAT_USER.service; then
2021-06-09 17:50:54 +08:00
TOMCAT_SERVICE=$TOMCAT_USER
2019-11-11 06:29:00 +08:00
2022-08-26 01:55:03 +08:00
[ -z "$TOMCAT_SERVICE" ] || systemctl start $TOMCAT_SERVICE || {
2022-08-05 04:34:10 +08:00
echo
echo "# Warning: $TOMCAT_SERVICE could not be started. Please, check BBB-LTI."
echo "# Run the command:"
echo "# sudo journalctl -u $TOMCAT_SERVICE"
echo "# To better understand the ERROR"
}
fi
2022-06-27 22:36:56 +08:00
2023-01-10 23:00:01 +08:00
systemctl restart bigbluebutton.target
2019-09-16 06:42:44 +08:00
2019-03-14 22:19:13 +08:00
if [ -f /usr/lib/systemd/system/bbb-html5.service ]; then
systemctl start mongod
sleep 3
systemctl start bbb-html5
2017-02-21 03:11:22 +08:00
fi
}
display_bigbluebutton_status () {
2020-08-28 06:13:15 +08:00
units="nginx freeswitch $REDIS_SERVICE bbb-apps-akka bbb-fsesl-akka"
2020-06-23 23:01:26 +08:00
2019-05-07 06:23:23 +08:00
if [ -d $TOMCAT_DIR ]; then
2021-06-09 17:50:54 +08:00
units="$units $TOMCAT_USER"
2019-05-07 06:23:23 +08:00
fi
2018-02-09 01:26:31 +08:00
2019-03-14 22:19:13 +08:00
if [ -f /usr/lib/systemd/system/bbb-html5.service ]; then
units="$units mongod bbb-html5 bbb-webrtc-sfu kurento-media-server"
2021-06-01 04:01:42 +08:00
2021-06-09 17:50:54 +08:00
for i in `seq 8888 8890`; do
# check if multi-kurento setup is configured
if [ -f /usr/lib/systemd/system/kurento-media-server-${i}.service ]; then
if systemctl is-enabled kurento-media-server-${i}.service > /dev/null; then
units="$units kurento-media-server-${i}"
fi
2021-06-01 04:01:42 +08:00
fi
2021-05-13 14:08:43 +08:00
done
2021-06-09 17:50:54 +08:00
source /usr/share/meteor/bundle/bbb-html5-with-roles.conf
2021-05-13 06:06:46 +08:00
if [ -f /etc/bigbluebutton/bbb-html5-with-roles.conf ]; then
source /etc/bigbluebutton/bbb-html5-with-roles.conf
fi
for ((i = 1 ; i <= $NUMBER_OF_BACKEND_NODEJS_PROCESSES; i++)); do
units="$units bbb-html5-backend@$i"
done
2021-06-09 17:50:54 +08:00
2021-05-13 14:08:43 +08:00
for ((i = 1; i <= $NUMBER_OF_FRONTEND_NODEJS_PROCESSES; i++)); do
2021-05-13 06:06:46 +08:00
units="$units bbb-html5-frontend@$i"
done
2019-03-14 22:19:13 +08:00
fi
2019-02-08 09:23:00 +08:00
2019-05-17 05:05:16 +08:00
if [ -f /usr/share/etherpad-lite/settings.json ]; then
units="$units etherpad"
fi
2022-09-01 23:40:01 +08:00
if [ -f /usr/lib/systemd/system/bbb-web.service ]; then
2019-03-14 22:19:13 +08:00
units="$units bbb-web"
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
2019-10-14 01:11:16 +08:00
if [ -f /usr/lib/systemd/system/bbb-webhooks.service ]; then
units="$units bbb-webhooks"
fi
2022-09-01 23:40:01 +08:00
if [ -f /usr/lib/systemd/system/bbb-lti.service ]; then
2019-07-14 21:36:14 +08:00
units="$units bbb-lti"
fi
2022-01-26 00:35:45 +08:00
if [ -f /usr/lib/systemd/system/bbb-pads.service ]; then
2022-01-25 19:32:18 +08:00
units="$units bbb-pads"
fi
2022-07-08 01:40:04 +08:00
if [ -f /usr/lib/systemd/system/bbb-export-annotations.service ]; then
units="$units bbb-export-annotations"
fi
2022-08-05 18:57:03 +08:00
if [ -f /usr/lib/systemd/system/bbb-rap-caption-inbox.service ]; then
units="$units bbb-rap-caption-inbox"
fi
2022-09-01 23:40:01 +08:00
if [ -f /usr/lib/systemd/system/bbb-rap-resque-worker.service ]; then
2022-08-05 18:57:03 +08:00
units="$units bbb-rap-resque-worker"
fi
2022-09-01 23:40:01 +08:00
if [ -f /usr/lib/systemd/system/bbb-rap-starter.service ]; then
2022-08-05 18:57:03 +08:00
units="$units bbb-rap-starter"
fi
2020-12-19 08:47:59 +08:00
if systemctl list-units --full -all | grep -q $TOMCAT_USER.service; then
TOMCAT_SERVICE=$TOMCAT_USER
fi
2019-03-14 22:19:13 +08:00
line='——————————————————————►'
for unit in $units; do
status=$(systemctl is-active "$unit")
if [ "$status" = "active" ]; then
printf "%s %s [✔ - $status]\n" $unit "${line:${#unit}}"
else
printf "%s %s [✘ - $status]\n" $unit "${line:${#unit}}"
fi
done
2017-02-21 03:11:22 +08:00
}
if [ $# -eq 0 ]; then
2019-03-14 22:19:13 +08:00
usage
exit 1
2017-02-21 03:11:22 +08:00
fi
# Parse the parameters
while [ $# -gt 0 ]; do
2019-03-14 22:19:13 +08:00
if [ "$1" = "-stop" -o "$1" = "--stop" ]; then
need_root
stop_bigbluebutton
exit 0
fi
if [ "$1" = "-start" -o "$1" = "--start" ]; then
need_root
start_bigbluebutton
exit 0
fi
if [ "$1" = "-check" -o "$1" = "--check" -o "$1" = "-c" ]; then
CHECK=1
shift;shift
continue
fi
if [ "$1" = "--version" -o "$1" = "-version" -o "$1" = "-v" ]; then
VERSION=1
shift
continue
fi
if [ "$1" = "--debug" -o "$1" = "-debug" -o "$1" = "-d" ]; then
DEBUG=1
shift
continue
fi
if [ "$1" = "--clean" -o "$1" = "-clean" ]; then
CLEAN=1
shift
continue
fi
if [ "$1" = "--watch" -o "$1" = "-watch" -o "$1" = "-w" ]; then
WATCH=1
shift
continue
fi
if [ "$1" = "--network" -o "$1" = "-network" -o "$1" = "-n" ]; then
NETWORK=1
shift
continue
fi
if [ "$1" = "--zip" -o "$1" = "-zip" -o "$1" = "-z" ]; then
ZIP=1
shift
continue
fi
if [ "$1" = "--status" -o "$1" = "-status" ]; then
display_bigbluebutton_status
exit 0
fi
if [ "$1" = "--restart" -o "$1" = "-restart" ]; then
RESTART=1
shift
continue
fi
#
# all other parameters requires at least 1 argument
#
if [ "$1" = "-setip" -o "$1" = "--setip" ]; then
HOST="${2}"
if [ -z "$HOST" ]; then
echo "HOST IP=$IP"
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
if echo $HOST|grep -q ":"; then
HOST=$(echo ${2}|cut -d: -f1)
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
shift; shift
continue
fi
2017-02-21 03:11:22 +08:00
2022-05-26 07:16:39 +08:00
if [ "$1" = "--set-port-range" ]; then
PORT_RANGE="${2}"
shift; shift
continue
fi
2019-03-14 22:19:13 +08:00
if [ "$1" = "--salt" -o "$1" = "-salt" -o "$1" = "--setsalt" -o "$1" = "--secret" -o "$1" = "-secret" -o "$1" = "--setsecret" ]; then
SECRET="${2}"
if [ -z "$SECRET" ]; then
2021-02-23 19:48:26 +08:00
BBB_WEB_URL=$(get_bbb_web_config_value bigbluebutton.web.serverURL)
SECRET=$(get_bbb_web_config_value securitySalt)
2019-03-14 22:19:13 +08:00
echo
echo " URL: $BBB_WEB_URL/bigbluebutton/"
echo " Secret: $SECRET"
echo
echo " Link to the API-Mate:"
2019-09-10 19:44:05 +08:00
echo " https://mconf.github.io/api-mate/#server=$BBB_WEB_URL/bigbluebutton/&sharedSecret=$SECRET"
2019-03-14 22:19:13 +08:00
echo
exit 0
fi
shift; shift
continue
fi
if [ "$1" = "--lti" -o "$1" = "-lti" ]; then
if [ -z "$SECRET" ]; then
if [ -f ${LTI_DIR}/WEB-INF/classes/lti-config.properties ]; then
2019-09-10 19:44:05 +08:00
LTI_URL="${PROTOCOL}://"$(cat ${LTI_DIR}/WEB-INF/classes/lti-config.properties | grep -v '#' | sed -n '/^ltiEndPoint/{s/^.*=//;p}')'/lti/tool'
2019-03-14 22:19:13 +08:00
CUSTOMER=$(cat ${LTI_DIR}/WEB-INF/classes/lti-config.properties | grep -v '#' | sed -n '/^ltiConsumer/{s/^.*=//;s/:.*//p}')
SECRET=$(cat ${LTI_DIR}/WEB-INF/classes/lti-config.properties | grep -v '#' | sed -n '/^ltiConsumer/{s/^[^:]*://;p}')
echo
echo " URL: $LTI_URL"
echo " Customer: $CUSTOMER"
echo " Secret: $SECRET"
echo
ICON_URL=$( echo $LTI_URL | sed 's/tool/images\/icon.ico/')
echo " Icon URL: $ICON_URL"
echo
echo
exit 0
fi
fi
shift; shift
continue
fi
usage
exit 1
2017-02-21 03:11:22 +08:00
done
2010-09-20 09:47:17 +08:00
2020-12-19 07:38:46 +08:00
print_bigbluebutton_version() {
echo
if [ $DISTRIB_ID == "centos" ]; then
2022-06-20 21:46:45 +08:00
echo "BigBlueButton Server $BIGBLUEBUTTON_RELEASE ($(rpm -qa | grep bbb | grep -v bbb-lti | grep -v bbb-redis | grep -v bbb-tomcat | grep -v freeswitch | sed 's/.*[0-9].[0-9].[0-9]-//g' | sed 's/\..*//g' | awk '{ sum+=$1} END {print sum}'))"
2020-12-19 07:38:46 +08:00
else
2022-06-20 21:46:45 +08:00
echo "BigBlueButton Server $BIGBLUEBUTTON_RELEASE ($(dpkg -l | grep bbb | grep -v bbb-lti | sed -n '/[0-9].[0-9].[0-9]-/{s/.*[0-9].[0-9].[0-9]-//;s/;//;p}' | awk '{ sum+=$1} END {print sum}'))"
2020-12-19 07:38:46 +08:00
fi
}
2017-02-21 03:11:22 +08:00
#
2019-03-14 22:19:13 +08:00
# Version
2017-02-21 03:11:22 +08:00
#
2019-03-14 22:19:13 +08:00
if [[ $VERSION ]]; then
2020-12-19 07:38:46 +08:00
print_bigbluebutton_version
2019-03-14 22:19:13 +08:00
echo
dpkg -l | grep bbb
exit 0
2017-02-21 03:11:22 +08:00
fi
#
2017-04-09 06:41:20 +08:00
# Set Shared Secret
2017-02-21 03:11:22 +08:00
#
2019-03-14 22:19:13 +08:00
if [[ $SECRET ]]; then
need_root
2022-04-11 20:25:48 +08:00
echo "Assigning secret in $BBB_WEB_ETC_CONFIG"
if [ -f "$BBB_WEB_ETC_CONFIG" ] && grep "^securitySalt" "$BBB_WEB_ETC_CONFIG" > /dev/null ; then
change_var_value "$BBB_WEB_ETC_CONFIG" securitySalt "$SECRET"
2021-02-23 19:48:26 +08:00
else
2022-04-11 23:40:42 +08:00
echo "securitySalt=$SECRET" >> "$BBB_WEB_ETC_CONFIG"
2021-02-23 19:48:26 +08:00
fi
2017-02-21 03:11:22 +08:00
2019-11-01 00:14:24 +08:00
if [ -f /usr/local/bigbluebutton/bbb-webhooks/config/default.yml ]; then
change_yml_value /usr/local/bigbluebutton/bbb-webhooks/config/default.yml sharedSecret $SECRET
2019-03-14 22:19:13 +08:00
fi
if [ -f /usr/local/bigbluebutton/bbb-webhooks/extra/post_catcher.js ]; then
sed -i "s|\(^[ \t]*var shared_secret[ =]*\)[^;]*|\1\"$SECRET\"|g" /usr/local/bigbluebutton/bbb-webhooks/extra/post_catcher.js
fi
2021-02-19 23:56:42 +08:00
if [ -f /etc/bigbluebutton/bbb-apps-akka.conf ]; then
sed -i "s/sharedSecret[ ]*=[ ]*\"[^\"]*\"/sharedSecret=\"$SECRET\"/g" /etc/bigbluebutton/bbb-apps-akka.conf
2019-03-14 22:19:13 +08:00
fi
2019-07-27 22:09:31 +08:00
if [ -f ${LTI_DIR}/WEB-INF/classes/lti-config.properties ]; then
sed -i "s/bigbluebuttonSalt=.*/bigbluebuttonSalt=$SECRET/g" ${LTI_DIR}/WEB-INF/classes/lti-config.properties
fi
2019-04-10 07:14:52 +08:00
echo
echo "BigBlueButton's shared secret is now $SECRET"
2019-03-14 22:19:13 +08:00
echo
echo "You must restart BigBlueButton for the changes to take effect"
2019-04-10 07:14:52 +08:00
echo
2019-03-14 22:19:13 +08:00
echo " $SUDO bbb-conf --restart"
echo
2019-04-10 07:14:52 +08:00
echo
2019-03-14 22:19:13 +08:00
fi
2022-05-26 07:16:39 +08:00
#
# Set Port Range
#
2022-05-28 01:02:12 +08:00
if [[ $PORT_RANGE ]]; then
if [[ "$PORT_RANGE" =~ ^([[:digit:]]+)-([[:digit:]]+)$ ]]; then
START_PORT=${BASH_REMATCH[1]}
END_PORT=${BASH_REMATCH[2]}
2022-05-26 07:16:39 +08:00
2022-05-28 06:12:24 +08:00
need_root
xmlstarlet edit --inplace --update '/configuration/settings/param[@name="rtp-start-port"]/@value' --value $START_PORT $FREESWITCH_SWITCH_CONF
xmlstarlet edit --inplace --update '/configuration/settings/param[@name="rtp-end-port"]/@value' --value $END_PORT $FREESWITCH_SWITCH_CONF
2022-05-26 07:16:39 +08:00
2022-05-28 01:02:12 +08:00
sed -i "s/minPort=.*/minPort=$START_PORT/" /etc/kurento/modules/kurento/BaseRtpEndpoint.conf.ini
sed -i "s/maxPort=.*/maxPort=$END_PORT/" /etc/kurento/modules/kurento/BaseRtpEndpoint.conf.ini
2022-05-26 07:16:39 +08:00
2022-06-17 04:29:36 +08:00
mkdir -p $(dirname $WEBRTC_SFU_ETC_CONFIG)
2022-06-01 09:37:52 +08:00
touch $WEBRTC_SFU_ETC_CONFIG
2022-05-30 03:03:08 +08:00
yq w -i $WEBRTC_SFU_ETC_CONFIG mediasoup.worker.rtcMinPort $START_PORT
yq w -i $WEBRTC_SFU_ETC_CONFIG mediasoup.worker.rtcMaxPort $END_PORT
2022-05-26 07:16:39 +08:00
2022-05-28 01:02:12 +08:00
echo
echo "BigBlueButton's UDP port range is now $START_PORT-$END_PORT"
echo
echo "You must restart BigBlueButton for the changes to take effect"
echo
echo " $SUDO bbb-conf --restart"
echo
echo
else
echo
echo "Warning: --set-port-range requires a numerical port range (default is 16384-32768)"
echo
echo "Port range remains unchanged"
echo
fi
2022-05-26 07:16:39 +08:00
fi
2019-03-14 22:19:13 +08:00
check_configuration() {
#
# Check that freeswtich ESL matches the value in bigbluebutton.properties
#
if [ -f $FREESWITCH_EVENT_SOCKET ]; then
FREESWITCH_ESL_IP=$(cat $FREESWITCH_EVENT_SOCKET | grep 'name="listen-ip"' | cut -d\" -f4 | awk '{print $1}')
check_no_value event_socket $FREESWITCH_EVENT_SOCKET $FREESWITCH_ESL_IP
fi
#
# Check if BigBlueButton is defined in Nginx
#
if [ ! -L /etc/nginx/sites-enabled/bigbluebutton ]; then
echo "# Nginx: BigBlueButton appears to be disabled"
echo " - no symbolic link in /etc/nginx/sites-enabled/bigbluebutton to /etc/nginx/sites-available/bigbluebutton "
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
#
# Look for properties with no values set
#
2019-11-17 07:35:21 +08:00
CONFIG_FILES="$SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties"
2023-04-19 19:42:31 +08:00
ignore_configs_args=()
ignore_configs_args+=(-e "redis.pass")
ignore_configs_args+=(-e "redisPassword")
ignore_configs_args+=(-e "disabledFeatures")
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
for file in $CONFIG_FILES ; do
if [ ! -f $file ]; then
echo "# Error: File not found: $file"
else
2023-04-19 19:42:31 +08:00
if cat $file | grep -v "${ignore_configs_args[@]}" | grep -v ^# | grep -q "^[^=]*=[ ]*$"; then
2019-03-14 22:19:13 +08:00
echo "# The following properties in $file have no value:"
2023-04-19 19:42:31 +08:00
echo "# $(grep '^[^=#]*=[ ]*$' $file | grep -v "${ignore_configs_args[@]}" | sed 's/=//g')"
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
done
2021-02-23 19:48:26 +08:00
VARFolder="$(get_bbb_web_config_value imageMagickDir)"
2019-03-14 22:19:13 +08:00
if [ ! -x $VARFolder/convert ]; then
echo "# ImageMagick's convert is not installed in $VARFolder"
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
#
# Check if the IP resolves to a different host
#
check_no_value server_name /etc/nginx/sites-available/bigbluebutton $NGINX_IP
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
if which host > /dev/null 2>&1; then
HOSTS=$(which host)
if [ $HOSTS ]; then
HOSTS=$($HOSTS $NGINX_IP | awk '{ print $4 }' | head -n 1)
fi
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
2021-02-23 19:48:26 +08:00
BBB_SECRET="$(get_bbb_web_config_value securitySalt)"
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
if [ -f /usr/lib/systemd/system/bbb-webhooks.service ]; then
2019-10-14 01:11:16 +08:00
WEBHOOKS_CONF=/usr/local/bigbluebutton/bbb-webhooks/config/default.yml
WEBHOOKS_SECRET=$(yq r $WEBHOOKS_CONF bbb.sharedSecret)
2018-06-25 03:27:57 +08:00
2019-03-14 22:19:13 +08:00
if [ "$BBB_SECRET" != "$WEBHOOKS_SECRET" ]; then
echo "# Warning: Webhooks API Shared Secret mismatch: "
echo "# ${SERVLET_DIR}/WEB-INF/classes/bigbluebutton.properties = $BBB_SECRET"
echo "# $WEBHOOKS_CONF = $WEBHOOKS_SECRET"
echo
fi
2018-06-25 03:27:57 +08:00
2022-03-15 10:01:37 +08:00
WEBHOOKS_PROXY_PORT=$(cat /usr/share/bigbluebutton/nginx/webhooks.nginx | grep -v '#' | grep '^[ \t]*proxy_pass[ \t]*' | sed 's|.*http[s]\?://[^:]*:\([^;]*\);.*|\1|g')
2019-10-14 01:11:16 +08:00
WEBHOOKS_APP_PORT=$(yq r $WEBHOOKS_CONF server.port)
2019-03-14 22:19:13 +08:00
if [ "$WEBHOOKS_PROXY_PORT" != "$WEBHOOKS_APP_PORT" ]; then
echo "# Warning: Webhooks port mismatch: "
2022-03-15 10:01:37 +08:00
echo "# /usr/share/bigbluebutton/nginx/webhooks.nginx = $WEBHOOKS_PROXY_PORT"
2019-03-14 22:19:13 +08:00
echo "# $WEBHOOKS_CONF = $WEBHOOKS_APP_PORT"
echo
fi
fi
if [ -f ${LTI_DIR}/WEB-INF/classes/lti-config.properties ]; then
LTI_SECRET=$(cat ${LTI_DIR}/WEB-INF/classes/lti-config.properties | grep -v '#' | tr -d '\r' | sed -n '/^bigbluebuttonSalt/{s/.*=//;p}')
if [ "$LTI_SECRET" != "$BBB_SECRET" ]; then
echo "# Warning: LTI shared secret mismatch:"
echo "# ${LTI_DIR}/WEB-INF/classes/lti-config.properties = $LTI_SECRET"
echo "# ${SERVLET_DIR}/WEB-INF/classes/bigbluebutton.properties = $BBB_SECRET"
echo
2018-06-25 03:27:57 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
2022-03-15 10:01:37 +08:00
SIP_PROTOCOL=$(cat /usr/share/bigbluebutton/nginx/sip.nginx | grep -v \# | sed -n '/proxy_pass/{s/.*proxy_pass [ ]*//;s/:.*//;p}' | head -n 1)
2019-03-16 07:32:06 +08:00
if [[ $SIP_PROTOCOL == "https" ]]; then
2019-03-14 22:19:13 +08:00
if ! grep wss-binding $FREESWITCH_EXTERNAL > /dev/null; then
2022-03-15 10:01:37 +08:00
echo "# Warning: Websockets is using HTTPS in /usr/share/bigbluebutton/nginx/sip.nginx"
2019-03-14 22:19:13 +08:00
echo "# but no definition for wss-binding found in "
echo "#"
echo "# $FREESWITCH_EXTERNAL"
echo
fi
fi
if [ "$(ls -ld /var/freeswitch/meetings | cut -d' ' -f3)" != "freeswitch" ]; then
echo "# Warning: Detected the directory"
echo "# /var/freeswitch/meetings"
echo "# is not owned by freeswitch"
fi
if [ "$(ls -ld /var/bigbluebutton | cut -d' ' -f3)" != $BBB_USER ]; then
echo "# Warning: Detected the directory"
echo "# /var/bigbluebutton"
echo "# is not owned by $BBB_USER"
fi
2018-08-25 03:02:51 +08:00
2020-11-23 21:11:06 +08:00
CHECK_STUN=$(xmlstarlet sel -t -m '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "external_rtp_ip=")]' -v @data $FREESWITCH_VARS | sed 's/external_rtp_ip=stun://g')
if [ "$CHECK_STUN" == "stun.freeswitch.org" ]; then
echo
echo "# Warning: Detected FreeSWITCH is using default stun.freeswitch.org server. See"
echo "#"
2023-05-26 02:58:06 +08:00
echo "# https://docs.bigbluebutton.org/support/troubleshooting#freeswitch-using-default-stun-server"
2020-11-23 21:11:06 +08:00
echo "#"
echo
2020-11-24 23:13:09 +08:00
fi
2020-11-23 21:11:06 +08:00
2020-11-28 05:40:44 +08:00
if ! which ufw > /dev/null 2>&1; then
2020-11-24 09:52:21 +08:00
echo
echo "# Warning: No firewall detected. Recommend using setting up a firewall for your server"
echo "#"
2023-05-26 02:53:43 +08:00
echo "# https://docs.bigbluebutton.org/administration/firewall-configuration"
2020-11-24 09:52:21 +08:00
echo "#"
echo
fi
2020-03-06 10:47:42 +08:00
}
2019-05-12 02:13:59 +08:00
2019-03-14 22:19:13 +08:00
check_state() {
echo
print_header
check_configuration
#
# Check for potential problems in the BigBlueButton configuration
#
RUNNING_APPS=""
NOT_RUNNING_APPS=""
if [[ -a $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"
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
if ! ps aux | grep -v grep | grep '[/]usr/sbin/nginx' > /dev/null; then
print_header
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} Nginx"
else
RUNNING_APPS="${RUNNING_APPS} Nginx"
fi
2022-03-24 04:50:19 +08:00
if ! ss -ant | grep '8090' > /dev/null; then
2019-03-14 22:19:13 +08:00
print_header
2022-09-02 10:09:42 +08:00
if [ ! -z "$TOMCAT_SERVICE" ]; then
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} ${TOMCAT_USER} or grails"
fi
2019-03-14 22:19:13 +08:00
else
if ps aux | ps -aef | grep -v grep | grep grails | grep run-app > /dev/null; then
print_header
RUNNING_APPS="${RUNNING_APPS} Grails"
2019-06-03 10:20:07 +08:00
echo "# ${TOMCAT_USER}: noticed you are running grails run-app instead of ${TOMCAT_USER}"
2019-03-14 22:19:13 +08:00
else
2022-09-02 10:09:42 +08:00
if [ ! -z "$TOMCAT_SERVICE" ]; then
RUNNING_APPS="${RUNNING_APPS} ${TOMCAT_USER}"
fi
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
if ! ps aux | grep -v grep | grep '[/]usr/[s]*bin/redis-server' > /dev/null; then
print_header
NOT_RUNNING_APPS="${NOT_RUNNING_APPS} redis-server"
else
RUNNING_APPS="${RUNNING_APPS} redis-server"
fi
if [ "$NOT_RUNNING_APPS" != "" ]; then
echo "# Not running: ${NOT_RUNNING_APPS}"
fi
#
# Check if running development environment
#
2022-03-15 10:01:37 +08:00
if ! grep 8090 /usr/share/bigbluebutton/nginx/web.nginx > /dev/null; then
2019-03-14 22:19:13 +08:00
echo "# Warning: nginx is not serving BigBlueButton's web application"
echo "# from port 8090"
echo "#"
echo "# (This is OK if you have setup a development environment.) "
echo
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
#
# Check FreeSWITCH
#
if grep -q "Thread ended for mod_event_socket" /opt/freeswitch/var/log/freeswitch/freeswitch.log; then
echo
echo "# Error: Found text in freeswitch.log:"
echo "#"
echo "# Thread ended for mod_event_socket"
echo "#"
echo "# FreeSWITCH may not be responding to requests on port 8021 (event socket layer)"
echo "# and users may have errors joining audio."
echo "#"
fi
#
# Check FreeSWITCH
#
2020-05-25 00:20:25 +08:00
ESL_PASSWORD=$(xmlstarlet sel -t -m 'configuration/settings/param[@name="password"]' -v @value /opt/freeswitch/etc/freeswitch/autoload_configs/event_socket.conf.xml)
if ! echo "/quit" | /opt/freeswitch/bin/fs_cli -p $ESL_PASSWORD - > /dev/null 2>&1; then
2019-03-14 22:19:13 +08:00
echo
echo "#"
echo "# Error: Unable to connect to the FreeSWITCH Event Socket Layer on port 8021"
echo "#"
fi
#
# Check for required external commands
#
2019-11-17 07:35:21 +08:00
COMMANDS="ruby gem pdftocairo"
2019-03-14 22:19:13 +08:00
for cmd in $COMMANDS ; do
if ! which $cmd > /dev/null 2>&1; then
echo "# $cmd command not found"
fi
done
#
# Check if ffmpeg is installed, and whether it is a supported version
#
FFMPEG_VERSION=$(ffmpeg -version 2>/dev/null | grep ffmpeg | cut -d ' ' -f3 | sed 's/--.*//g' | tr -d '\n')
case "$FFMPEG_VERSION" in
2019-01-04 03:07:46 +08:00
4.*.*)
2019-03-14 22:19:13 +08:00
# This is the current supported version; OK.
;;
2018-06-23 02:58:30 +08:00
'')
2019-03-14 22:19:13 +08:00
echo "# Warning: No ffmpeg version was found on the system"
echo "# Recording processing will not function"
echo
;;
2018-06-23 02:58:30 +08:00
*)
2019-03-14 22:19:13 +08:00
echo "# Warning: The installed ffmpeg version '${FFMPEG_VERSION}' is not recommended."
echo "# Recommend you update to the 4.0.x version of ffmpeg. To upgrade, do the following"
echo "#"
echo "# $SUDO apt-get install software-properties-common"
echo "# $SUDO add-apt-repository ppa:jonathonf/ffmpeg-4"
echo "# $SUDO apt-get update"
echo "# $SUDO apt-get dist-upgrade"
echo "#"
echo
;;
esac
#
# Check that the servlet container has started properly and has created log files
#
2019-05-07 06:23:23 +08:00
if [ -d $TOMCAT_DIR ]; then
if [ -z "$(ls -A $SERVLET_LOGS)" ]; then
2019-03-14 22:19:13 +08:00
echo "# empty directory: $SERVLET_LOGS contains no logs"
2019-05-07 06:23:23 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
#
# Check if the user is running their own bbb-web
#
2022-03-15 10:01:37 +08:00
if grep -q 8888 /usr/share/bigbluebutton/nginx/web.nginx; then
2022-03-24 04:50:19 +08:00
if ! ss -ant | grep '8888' > /dev/null; then
2019-03-14 22:19:13 +08:00
echo "# Warning: There is no application server listening to port 8888."
echo
fi
fi
#
# Check if the local server can access the API. This is a common problem when setting up BigBlueButton behind
# a firewall
#
2021-02-23 19:48:26 +08:00
BBB_WEB="$(get_bbb_web_config_value bigbluebutton.web.serverURL|sed -n '{s/.*\///;p}')"
2019-03-14 22:19:13 +08:00
check_no_value server_name /etc/nginx/sites-available/bigbluebutton $BBB_WEB
COUNT=0
while [ $COUNT -lt 80 ]; do
let COUNT=COUNT+1
2019-12-18 06:10:09 +08:00
timeout 1s curl -sS $PROTOCOL://$BBB_WEB/bigbluebutton/api | grep -q SUCCESS
2019-03-14 22:19:13 +08:00
if [ $? -eq 0 ]; then
2019-03-10 00:52:51 +08:00
let COUNT=80
2019-03-14 22:19:13 +08:00
else
2017-02-21 03:11:22 +08:00
echo -n "."
sleep 1
2019-03-14 22:19:13 +08:00
fi
done
echo
2019-12-18 06:10:09 +08:00
if ! curl -sS $PROTOCOL://$BBB_WEB/bigbluebutton/api | grep -q SUCCESS; then
2019-03-14 22:19:13 +08:00
echo "# Error: Could not connect to the configured hostname/IP address"
echo "#"
echo "# $PROTOCOL://$BBB_WEB/"
echo "#"
echo "# If your BigBlueButton server is behind a firewall, see FAQ."
echo
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
VARS_IP=$(cat $FREESWITCH_VARS | sed -n '/"local_ip_v4/{s/.*local_ip_v4=//;s/".*//;p}')
if [[ "$VARS_IP" != "127.0.0.1" ]] && [[ "$VARS_IP" != "auto" ]]; then
if [ "$VARS_IP" != $IP ]; then
echo "# Warning: The setting of $VARS_IP for local_ip_v4 in"
echo "#"
echo "# $FREESWITCH_VARS"
echo "#"
echo "# does not match the local IP address ($IP)."
echo "# (This is OK if you've manually changed the values)"
echo
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
if (( $MEM < 3940 )); then
echo "# Warning: You are running BigBlueButton on a server with less than 4G of memory. Your"
echo "# performance may suffer."
echo
fi
2021-02-23 19:48:26 +08:00
BBB_WEB="$(get_bbb_web_config_value bigbluebutton.web.serverURL)"
2019-03-14 22:19:13 +08:00
if [ -f ${LTI_DIR}/WEB-INF/classes/lti-config.properties ]; then
2019-09-10 19:44:05 +08:00
LTI_URL="${PROTOCOL}://"$(cat ${LTI_DIR}/WEB-INF/classes/lti-config.properties | grep -v '#' | sed -n '/^ltiEndPoint/{s/^.*=//;p}')'/lti/tool'
2019-03-14 22:19:13 +08:00
echo "# Warning: The IMS Learning Tools Integration (LTI) is accessible from:"
echo "#"
echo "# $LTI_URL"
echo "#"
echo "# To get the access parameters for LTI, run the command"
echo "#"
echo "# bbb-conf --lti"
echo
fi
2021-02-23 19:48:26 +08:00
DEFAULT_PDF="$(get_bbb_web_config_value beans.presentationService.defaultUploadedPresentation)"
2019-03-14 22:19:13 +08:00
if echo $DEFAULT_PDF | grep -q "bigbluebutton.web.serverURL"; then
2019-12-18 06:10:09 +08:00
if ! echo "$BBB_WEB$(echo $DEFAULT_PDF | sed 's/${bigbluebutton.web.serverURL}//g')" | xargs curl -sS >/dev/null; then
2019-03-14 22:19:13 +08:00
echo "# Error: Unable to reach default URL for presentation:"
echo "#"
echo "# $BBB_WEB$(echo $DEFAULT_PDF | sed 's/${bigbluebutton.web.serverURL}//g')"
echo "#"
echo "# Check value for beans.presentationService.defaultUploadedPresentation in"
2021-02-23 19:48:26 +08:00
echo "# $BBB_WEB_CONFIG and $BBB_WEB_ETC_CONFIG"
2019-03-14 22:19:13 +08:00
fi
else
2019-12-18 06:10:09 +08:00
if ! echo "$DEFAULT_PDF" | xargs curl -sS >/dev/null; then
2019-03-14 22:19:13 +08:00
echo "# Error: Unable to reach default URL for presentation"
echo "#"
echo "# $DEFAULT_PDF"
echo "#"
echo "# Check value for beans.presentationService.defaultUploadedPresentation in"
2021-02-23 19:48:26 +08:00
echo "# $BBB_WEB_CONFIG and $BBB_WEB_ETC_CONFIG"
2019-03-14 22:19:13 +08:00
fi
fi
2021-02-20 00:18:11 +08:00
if [ "$(cat /etc/bigbluebutton/bbb-apps-akka.conf | sed -n '/sharedSecret.*/{s/[^"]*"//;s/".*//;p}')" == "changeme" ]; then
2021-02-23 19:48:26 +08:00
BBB_WEB_IP="$(get_bbb_web_config_value bigbluebutton.web.serverURL|sed -n '{s/.*\///;p}')"
2021-02-20 00:18:11 +08:00
echo "# Error: Detected that /etc/bigbluebutton/bbb-apps-akka.conf has the default"
2019-03-14 22:19:13 +08:00
echo "# configuration values. To update, run"
echo "#"
echo "# $SUDO bbb-conf --setip $BBB_WEB_IP"
echo "#"
fi
2017-03-07 03:57:54 +08:00
2019-03-14 22:19:13 +08:00
if bbb-conf --status | grep -q inactive; then
2022-07-01 23:06:41 +08:00
if systemctl list-units --full -all | grep -q $TOMCAT_USER.service; then
TOMCAT_SERVICE=$TOMCAT_USER
2022-07-06 03:19:07 +08:00
if bbb-conf --status | grep -q inactive | grep -q $TOMCAT_SERVICE; then
2022-07-01 23:06:41 +08:00
echo "# Warning: $TOMCAT_SERVICE is not started correctly"
echo "#"
fi
2022-07-06 03:19:07 +08:00
fi
if bbb-conf --status | grep inactive; then
2022-06-27 22:36:56 +08:00
echo "# Error: Detected some processes have not started correctly"
echo "#"
2022-07-01 23:06:41 +08:00
echo "# $(bbb-conf --status | grep inactive)"
2022-06-27 22:36:56 +08:00
echo "#"
fi
2019-03-14 22:19:13 +08:00
fi
2017-03-07 03:57:54 +08:00
2019-03-14 22:19:13 +08:00
if systemctl status freeswitch | grep -q SETSCHEDULER; then
echo "# Error: FreeSWITCH failed to start with SETSCHEDULER error, see"
echo "#"
2023-05-26 02:58:06 +08:00
echo "# https://docs.bigbluebutton.org/support/troubleshooting#freeswitch-fails-to-start-with-a-setscheduler-error"
2019-03-14 22:19:13 +08:00
echo "#"
fi
2019-01-17 04:22:10 +08:00
2019-03-14 22:19:13 +08:00
NCPU=$(nproc --all)
if [ "$NCPU" -lt "4" ]; then
2019-04-09 04:52:28 +08:00
echo "# Warning: found only $NCPU cores, whereas this server should have (at least) 4 CPU cores"
2019-03-14 22:19:13 +08:00
echo "# to run BigBlueButton in production."
echo "#"
2023-05-26 02:58:06 +08:00
echo "# https://docs.bigbluebutton.org/administration/install#minimum-server-requirements"
2019-03-14 22:19:13 +08:00
echo "#"
fi
2019-01-26 01:47:41 +08:00
2021-10-06 03:57:16 +08:00
if [ "$(echo "$HTML5_CONFIG" | yq r - public.media.sipjsHackViaWs)" != "true" ]; then
2020-11-24 09:52:21 +08:00
if [ "$PROTOCOL" == "https" ]; then
if ! cat $SIP_CONFIG | grep -v '#' | grep proxy_pass | head -n 1 | grep -q https; then
echo "# Warning: You have this server defined for https, but in"
echo "#"
echo "# $SIP_CONFIG"
echo "#"
echo "# did not find the use of https in definition for proxy_pass"
echo "#"
echo "# $(cat $SIP_CONFIG | grep -v '#' | grep proxy_pass | head -n 1)"
echo "#"
fi
2019-03-16 07:32:06 +08:00
2021-06-09 17:50:54 +08:00
if [ "$SIP_NGINX_IP" != $IP ]; then
if [ "$SIP_NGINX_IP" != "\$freeswitch_addr" ]; then
echo "# Warning: The setting of $SIP_NGINX_IP for proxy_pass in"
echo "#"
2022-03-15 10:01:37 +08:00
echo "# /usr/share/bigbluebutton/nginx/sip.nginx"
2021-06-09 17:50:54 +08:00
echo "#"
echo "# does not match the local IP address ($IP)."
echo "# (This is OK if you've manually changed the values)"
echo
fi
fi
2020-11-24 09:52:21 +08:00
if ! cat $SIP_CONFIG | grep -v '#' | grep proxy_pass | head -n 1 | grep -q 7443; then
echo
echo "# Warning: You have this server defined for https, but in"
echo "#"
echo "# $SIP_CONFIG"
echo "#"
echo "# did not find the use of port 7443 in definition for proxy_pass"
echo "#"
echo "# $(cat $SIP_CONFIG | grep -v '#' | grep proxy_pass | head -n 1)"
echo "#"
fi
2019-03-16 07:32:06 +08:00
fi
fi
2021-02-23 19:48:26 +08:00
CHECK="$(get_bbb_web_config_value securitySalt|sha1sum |cut -d' ' -f1)"
2019-04-10 07:14:52 +08:00
if [ "$CHECK" == "55b727b294158a877212570c3c0524c2b902a62c" ]; then
2020-06-23 23:01:26 +08:00
echo
2019-04-10 07:14:52 +08:00
echo "#"
echo "# Warning: Detected you have the default shared secret. You MUST change your shared"
echo "# secret NOW for BigBlueButton to finish starting up. Do either"
echo "#"
echo "# sudo bbb-conf --setsecret <secret>"
echo "#"
echo "# or, to have openssl generate a strong secret for you (recommended)"
echo "#"
2019-04-14 22:46:20 +08:00
echo "# sudo bbb-conf --setsecret \$(openssl rand -base64 32 | sed 's/=//g' | sed 's/+//g' | sed 's/\///g')"
2019-04-10 07:14:52 +08:00
echo "#"
echo "# Be sure to update any integrations with the new shared secret."
echo "#"
systemctl stop bbb-web
exit 1
fi
2019-03-16 07:32:06 +08:00
2019-06-24 06:22:08 +08:00
if ! systemctl show-environment | grep LANG= | grep -q UTF-8; then
2020-06-23 23:01:26 +08:00
echo
2019-06-21 09:21:25 +08:00
echo "#"
2019-06-27 05:44:05 +08:00
echo "# Warning: Detected that systemctl does not define a UTF-8 language."
2019-06-21 09:21:25 +08:00
echo "#"
2019-06-24 06:22:08 +08:00
echo "# To temporarily correct, run the command "
2019-06-21 09:21:25 +08:00
echo "#"
2019-07-06 03:16:29 +08:00
echo "# sudo systemctl set-environment LANG=en_US.UTF-8"
2019-06-21 09:21:25 +08:00
echo "#"
2023-05-26 02:58:06 +08:00
echo "# See https://docs.bigbluebutton.org/administration/install#pre-installation-checks"
2019-06-21 09:21:25 +08:00
echo "#"
fi
if [ "$(stat -c "%U %G" /var/bigbluebutton)" != "bigbluebutton bigbluebutton" ]; then
2020-06-23 23:01:26 +08:00
echo
2019-06-21 09:21:25 +08:00
echo "#"
echo "# Warning: The directory"
echo "#"
echo "# /var/bigbluebutton"
echo "#"
echo "# is not owned by bigbluebutton:bigbluebutton. To fix, run the command"
echo "#"
echo "# sudo chown -R bigbluebutton:bigbluebutton /var/bigbluebutton"
echo "#"
fi
2022-03-27 20:48:46 +08:00
FREESWITCH_SIP=$(ss -anlt4 | grep :5066 | grep -v tcp6 | grep LISTEN | sed 's/ [ ]*/ /g' | cut -d' ' -f4 | sed 's/:5066//g')
2022-05-05 10:05:59 +08:00
WEBRTC_SFU_SIP_IP=$(echo "$WEBRTC_SFU_CONFIG" | yq r - freeswitch.sip_ip)
2020-05-16 21:45:27 +08:00
if [ ! -z "$FREESWITCH_SIP" ]; then
2022-05-05 10:05:59 +08:00
if [ "$FREESWITCH_SIP" != "$WEBRTC_SFU_SIP_IP" ]; then
2021-06-09 17:50:54 +08:00
echo
echo "#"
2022-05-05 10:05:59 +08:00
echo "# bbb-webrtc-sfu will try to connect to $WEBRTC_SFU_SIP_IP but FreeSWITCH is listening on $FREESWITCH_SIP for port 5066"
2021-06-09 17:50:54 +08:00
echo "#"
echo "# To fix, run the commands"
echo "#"
echo "# sudo yq w -i /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml freeswitch.sip_ip $FREESWITCH_SIP"
echo "# sudo chown bigbluebutton:bigbluebutton /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml"
echo "#"
fi
2020-05-16 21:45:27 +08:00
fi
2021-02-14 10:19:58 +08:00
if [ ! -z "$STUN" ]; then
2021-06-30 00:03:38 +08:00
for i in $STUN; do
STUN_SERVER="$(xmlstarlet sel -N x="http://www.springframework.org/schema/beans" -t -m "_:beans/_:bean[@id=\"$i\"]/_:constructor-arg[@index=\"0\"]" -v @value $TURN | sed 's/stun://g')"
2021-07-19 22:02:58 +08:00
2022-10-15 02:21:11 +08:00
# stun is from the stun-client package, which is available on both bionic and focal
# stunclient is from the stuntman-client package, which is available on bionic but was removed from focal
if which stun > /dev/null 2>&1; then
# stun return codes, from its client.cxx
# low nibble: open (0), various STUN combinations (2-9), firewall (a), blocked (c), unknown (e), error (f)
# high nibble: hairpin (1)
stun $STUN_SERVER > /dev/null
if (( ($? & 0xf) > 9 )); then
echo
echo "#"
echo "# Warning: Failed to verify STUN server at $STUN_SERVER with command"
echo "#"
echo "# stun $STUN_SERVER"
echo "#"
fi
elif which stunclient > /dev/null 2>&1; then
if echo $STUN_SERVER | grep -q ':'; then
STUN_SERVER="$(echo $STUN_SERVER | sed 's/:.*//g') $(echo $STUN_SERVER | sed 's/.*://g')"
else
STUN_SERVER="$STUN_SERVER 3478"
fi
if stunclient $STUN_SERVER | grep -q "fail\|Unable\ to\ resolve"; then
2021-06-30 00:03:38 +08:00
echo
echo "#"
echo "# Warning: Failed to verify STUN server at $STUN_SERVER with command"
echo "#"
2022-10-15 02:21:11 +08:00
echo "# stunclient $STUN_SERVER"
2021-06-30 00:03:38 +08:00
echo "#"
fi
2021-05-14 07:00:00 +08:00
fi
2021-06-30 00:03:38 +08:00
done
2021-02-14 10:19:58 +08:00
fi
2022-02-06 00:05:43 +08:00
BBB_LOG="/var/log/bigbluebutton"
if [ "$(stat -c "%U %G" $BBB_LOG)" != "bigbluebutton bigbluebutton" ]; then
echo
echo "#"
echo "# Warning: The directory"
echo "#"
echo "# $BBB_LOG"
echo "#"
echo "# is not owned by bigbluebutton:bigbluebutton. To fix, run the command"
echo "#"
echo "# sudo chown bigbluebutton:bigbluebutton $BBB_LOG"
echo "#"
fi
BBB_LOG_FILES="$BBB_LOG/bbb-rap-worker.log $BBB_LOG/bbb-web.log $BBB_LOG/post_publish.log $BBB_LOG/sanity.log"
for log_file in $BBB_LOG_FILES; do
if [ -f "$log_file" ] && [ "$(stat -c "%U %G" $log_file)" != "bigbluebutton bigbluebutton" ]; then
echo
echo "#"
echo "# Warning: The file"
echo "#"
echo "# $log_file"
echo "#"
echo "# is not owned by bigbluebutton:bigbluebutton. To fix, run the command"
echo "#"
echo "# sudo chown bigbluebutton:bigbluebutton $log_file"
echo "#"
fi
done
if [ -d /var/lib/gems/2.5.0/cache ]; then
for gem_file in /var/lib/gems/2.5.0/cache/*; do
if [ ! -s $gem_file ]; then
echo "#"
echo "# Warning: Found a zero byte size gem file"
echo "#"
echo "# $gem_file"
echo "#"
fi
done
fi
if journalctl -u bbb-rap-* | grep -q 'Nil'; then
echo
echo "#"
echo "# Warning: found 'Nil' message in recording processing logs. Possible GEM errors"
echo "#"
echo "# https://github.com/bigbluebutton/bigbluebutton/issues/14287"
echo "#"
fi
2021-02-14 10:19:58 +08:00
2019-03-14 22:19:13 +08:00
exit 0
2017-02-21 03:11:22 +08:00
}
#
# Print out the status of the current setup and look for configuration issues
#
if [ $CHECK ]; then
2019-03-14 22:19:13 +08:00
need_root
2017-02-21 03:11:22 +08:00
2020-12-19 07:38:46 +08:00
print_bigbluebutton_version
2018-12-28 11:12:27 +08:00
2019-03-14 22:19:13 +08:00
echo " Kernel version:" $(uname -r)
2018-05-13 20:18:07 +08:00
2019-03-14 22:19:13 +08:00
if [ $DISTRIB_ID == "centos" ]; then
echo -n " Distribution: $(cat /etc/centos-release)"
else
source /etc/lsb-release
echo -n " Distribution: $DISTRIB_DESCRIPTION "
fi
if [ $(uname -m) == "x86_64" ]; then
echo "(64-bit)"
elif [ $(uname -m) == "i686" ]; then
echo "(32-bit)"
fi
2019-03-17 07:19:09 +08:00
echo " Memory: $MEM MB"
echo " CPU cores: $NCPU"
2019-03-14 22:19:13 +08:00
echo
2021-03-08 09:48:08 +08:00
echo "$BBB_WEB_ETC_CONFIG (override for bbb-web)"
2019-03-14 22:19:13 +08:00
echo "$BBB_WEB_CONFIG (bbb-web)"
2021-02-23 19:48:26 +08:00
echo " bigbluebutton.web.serverURL: $(get_bbb_web_config_value bigbluebutton.web.serverURL)"
echo " defaultGuestPolicy: $(get_bbb_web_config_value defaultGuestPolicy)"
2021-07-19 22:02:58 +08:00
echo " defaultMeetingLayout: $(get_bbb_web_config_value defaultMeetingLayout)"
2019-03-14 22:19:13 +08:00
echo
echo "/etc/nginx/sites-available/bigbluebutton (nginx)"
2020-12-19 07:38:46 +08:00
echo " server_name: $NGINX_IP"
2019-03-14 22:19:13 +08:00
PORT=$(cat /etc/nginx/sites-available/bigbluebutton | grep -v '#' | sed -n '/listen/{s/.*listen[ ]*//;s/;//;p}' | grep -v ssl | tr --delete '\n' | sed 's/\[/, \[/g' | sed 's/0$/0\n/g')
echo " port: $PORT"
if cat /etc/nginx/sites-available/bigbluebutton | grep -v '#' | sed -n '/listen/{s/.*listen[ ]*//;s/;//;p}' | grep ssl > /dev/null; then
echo " port: 443 ssl"
fi
echo
echo "$FREESWITCH_VARS (FreeSWITCH)"
echo " local_ip_v4: $(xmlstarlet sel -t -m '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "local_ip_v4=")]' -v @data $FREESWITCH_VARS | sed 's/local_ip_v4=//g')"
echo " external_rtp_ip: $(xmlstarlet sel -t -m '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "external_rtp_ip=")]' -v @data $FREESWITCH_VARS | sed 's/external_rtp_ip=//g')"
echo " external_sip_ip: $(xmlstarlet sel -t -m '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "external_sip_ip=")]' -v @data $FREESWITCH_VARS | sed 's/external_sip_ip=//g')"
echo
echo "$FREESWITCH_EXTERNAL (FreeSWITCH)"
echo " ext-rtp-ip: $(xmlstarlet sel -t -m 'profile/settings/param[@name="ext-rtp-ip"]' -v @value $FREESWITCH_EXTERNAL)"
echo " ext-sip-ip: $(xmlstarlet sel -t -m 'profile/settings/param[@name="ext-sip-ip"]' -v @value $FREESWITCH_EXTERNAL)"
echo " ws-binding: $(xmlstarlet sel -t -m 'profile/settings/param[@name="ws-binding"]' -v @value $FREESWITCH_EXTERNAL)"
echo " wss-binding: $(xmlstarlet sel -t -m 'profile/settings/param[@name="wss-binding"]' -v @value $FREESWITCH_EXTERNAL)"
2022-05-28 01:02:12 +08:00
# awk script from https://stackoverflow.com/a/14527886/1493790
# open issue: a tool like crudini (https://stackoverflow.com/a/25513632/1493790)
# would be better for parsing ini files
echo
echo "UDP port ranges"
echo
echo " FreeSWITCH: $(xmlstarlet sel -t -m './configuration/settings/param[@name="rtp-start-port"]' -v @value $FREESWITCH_SWITCH_CONF)-$(xmlstarlet sel -t -m './configuration/settings/param[@name="rtp-end-port"]' -v @value $FREESWITCH_SWITCH_CONF)"
echo " kurento: $(awk -F '=' '{if (! ($0 ~ /^;/) && $0 ~ /minPort/) print $2}' /etc/kurento/modules/kurento/BaseRtpEndpoint.conf.ini)-$(awk -F '=' '{if (! ($0 ~ /^;/) && $0 ~ /maxPort/) print $2}' /etc/kurento/modules/kurento/BaseRtpEndpoint.conf.ini)"
echo " bbb-webrtc-sfu: $(echo "$WEBRTC_SFU_CONFIG" | yq r - mediasoup.worker.rtcMinPort)-$(echo "$WEBRTC_SFU_CONFIG" | yq r - mediasoup.worker.rtcMaxPort)"
2019-03-14 22:19:13 +08:00
# if [ -f ${LTI_DIR}/WEB-INF/classes/lti-config.properties ]; then
# LTI_URL=$(cat ${LTI_DIR}/WEB-INF/classes/lti-config.properties | grep -v '#' | sed -n '/^bigbluebuttonURL/{s/.*http[s]:\/\///;s/\/.*//;p}' | tr -d '\015')
# echo
# echo "${LTI_DIR}/WEB-INF/classes/lti-config.properties (LTI integration)"
# echo " api url: $LTI_URL"
# fi
if [ -f $RECORD_CONFIG ]; then
echo
echo "$RECORD_CONFIG (record and playback)"
echo " playback_host: $(yq r $RECORD_CONFIG playback_host)"
echo " playback_protocol: $(yq r $RECORD_CONFIG playback_protocol)"
echo " ffmpeg: $(ffmpeg -version 2>/dev/null | grep ffmpeg | cut -d ' ' -f3 | sed 's/--.*//g' | tr -d '\n')"
fi
2019-02-11 01:48:17 +08:00
2019-03-14 22:19:13 +08:00
if [ -f $SIP_CONFIG ]; then
echo
echo "$SIP_CONFIG (sip.nginx)"
echo " proxy_pass: $SIP_NGINX_IP"
2022-03-15 10:01:37 +08:00
echo " protocol: $(cat /usr/share/bigbluebutton/nginx/sip.nginx | grep -v \# | sed -n '/proxy_pass/{s/.*proxy_pass [ ]*//;s/:.*//;p}' | head -n 1)"
2019-03-14 22:19:13 +08:00
fi
2022-05-05 10:05:59 +08:00
if [ -n "$WEBRTC_SFU_CONFIG" ]; then
2022-05-05 10:06:55 +08:00
MEDIASOUP_WEBRTC_IPS=$(echo "$WEBRTC_SFU_CONFIG" | yq r --printMode v - mediasoup.webrtc.listenIps.*.announcedIp)
2021-06-09 17:50:54 +08:00
echo
2022-05-05 10:05:59 +08:00
echo "/usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml (bbb-webrtc-sfu)"
echo "/etc/bigbluebutton/bbb-webrtc-sfu/production.yml (bbb-webrtc-sfu - override)"
2022-05-05 10:06:55 +08:00
echo " mediasoup.webrtc.*.announcedIp: $(echo "$MEDIASOUP_WEBRTC_IPS" | awk -v ORS=", " '{ print $1 }' | sed 's/, $//')"
echo " mediasoup.plainRtp.*.announcedIp: $(echo "$WEBRTC_SFU_CONFIG" | yq r --printMode v - mediasoup.plainRtp.*.announcedIp)"
2022-05-05 10:05:59 +08:00
echo " kurento.ip: $(echo "$WEBRTC_SFU_CONFIG" | yq r - kurento[0].ip)"
echo " kurento.url: $(echo "$WEBRTC_SFU_CONFIG" | yq r - kurento[0].url)"
echo " freeswitch.sip_ip: $(echo "$WEBRTC_SFU_CONFIG" | yq r - freeswitch.sip_ip)"
echo " recordScreenSharing: $(echo "$WEBRTC_SFU_CONFIG" | yq r - recordScreenSharing)"
echo " recordWebcams: $(echo "$WEBRTC_SFU_CONFIG" | yq r - recordWebcams)"
echo " codec_video_main: $(echo "$WEBRTC_SFU_CONFIG" | yq r - conference-media-specs.codec_video_main)"
echo " codec_video_content: $(echo "$WEBRTC_SFU_CONFIG" | yq r - conference-media-specs.codec_video_content)"
2019-03-14 22:19:13 +08:00
fi
2022-06-20 21:46:45 +08:00
if [ -n "$HTML5_CONFIG" ]; then
echo
echo "/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml (HTML5 client)"
echo "/etc/bigbluebutton/bbb-html5.yml (HTML5 client config override)"
echo " build: $(echo "$HTML5_CONFIG" | yq r - public.app.html5ClientBuild)"
echo " kurentoUrl: $(echo "$HTML5_CONFIG" | yq r - public.kurento.wsUrl)"
echo " defaultFullAudioBridge: $(echo "$HTML5_CONFIG" | yq r - public.media.audio.defaultFullAudioBridge)"
echo " defaultListenOnlyBridge: $(echo "$HTML5_CONFIG" | yq r - public.media.audio.defaultListenOnlyBridge)"
echo " sipjsHackViaWs: $(echo "$HTML5_CONFIG" | yq r - public.media.sipjsHackViaWs)"
fi
if [ ! -z "$STUN" ]; then
for i in $STUN; do
2019-03-14 22:19:13 +08:00
echo
2022-06-20 21:46:45 +08:00
echo "$TURN (STUN Server)"
echo " stun: $(xmlstarlet sel -N x="http://www.springframework.org/schema/beans" -t -m "_:beans/_:bean[@id=\"$i\"]/_:constructor-arg[@index=\"0\"]" -v @value $TURN | sed 's/stun://g')"
done
fi
check_state
echo
exit 0
2017-02-21 03:11:22 +08:00
fi
#
2018-07-24 17:35:48 +08:00
# Zip log files
2017-02-21 03:11:22 +08:00
#
if [ $ZIP ]; then
2019-03-14 22:19:13 +08:00
need_root
LOG_FILE="$(date +'%Y%m%d')-$(date +%H).tar"
TMP_LOG_FILE="/tmp/$LOG_FILE"
#
# Check log files
#
rm -f "$LOG_FILE.gz"
rm -f /tmp/a
touch /tmp/empty
tar cf $TMP_LOG_FILE /tmp/empty > /dev/null 2>&1
tar rfh $TMP_LOG_FILE $SERVLET_LOGS > /dev/null 2>&1
tar rf $TMP_LOG_FILE /var/log/bigbluebutton/* > /dev/null 2>&1
tar rf $TMP_LOG_FILE /var/log/bbb-apps-akka > /dev/null 2>&1
tar rf $TMP_LOG_FILE /var/log/bbb-fsesl-akka > /dev/null 2>&1
tar rf $TMP_LOG_FILE /var/log/bbb-webrtc-sfu > /dev/null 2>&1
tar rf $TMP_LOG_FILE /var/log/kurento-media-server > /dev/null 2>&1
tar rf $TMP_LOG_FILE /var/log/mongodb > /dev/null 2>&1
2019-12-25 22:25:17 +08:00
tar rf $TMP_LOG_FILE /var/log/redis > /dev/null 2>&1
2020-07-15 16:31:45 +08:00
tar rf $TMP_LOG_FILE /var/log/nginx/error.log* > /dev/null 2>&1
2020-12-19 07:38:46 +08:00
tar rf $TMP_LOG_FILE /var/log/nginx/bigbluebutton.access.log* > /dev/null 2>&1
2020-07-15 16:31:45 +08:00
tar rfh $TMP_LOG_FILE /opt/freeswitch/var/log/freeswitch/ > /dev/null 2>&1
2019-12-25 22:25:17 +08:00
if [ -f /var/log/nginx/html5-client.log ]; then
tar rf $TMP_LOG_FILE /var/log/nginx/html5-client.log* > /dev/null 2>&1
fi
if [ -f /var/log/syslog ]; then
tar rf $TMP_LOG_FILE /var/log/syslog* > /dev/null 2>&1
2019-03-14 22:19:13 +08:00
fi
tar tf $TMP_LOG_FILE
gzip $TMP_LOG_FILE
$SUDO mv $TMP_LOG_FILE.gz /root/$LOG_FILE.gz
echo
echo " Created: /root/$LOG_FILE.gz"
echo
2017-02-21 03:11:22 +08:00
fi
#
# Check current setup
#
if [ $DEBUG ]; then
2019-03-14 22:19:13 +08:00
need_root
#
# Check log files
#
rm -rf /tmp/t
grep --directories=skip ERROR /var/log/bigbluebutton/* > /tmp/t
if [ -s /tmp/t ]; then
echo " -- ERRORS found in /var/log/bigbluebutton/* -- "
cat /tmp/t
echo
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
rm -rf /tmp/t
grep --directories=skip Exception /var/log/bigbluebutton/* | grep -v CacheExceptionHandlerFactory > /tmp/t
if [ -s /tmp/t ]; then
echo " -- ERRORS found in /var/log/bigbluebutton/* -- "
cat /tmp/t
echo
fi
2017-02-21 03:11:22 +08:00
2019-10-15 07:57:38 +08:00
if [ -d $SERVLET_LOGS ]; then
rm -rf /tmp/t
$SUDO grep --directories=skip Exception $SERVLET_LOGS/* | grep -v CacheExceptionHandlerFactory > /tmp/t
if [ -s /tmp/t ]; then
2019-03-14 22:19:13 +08:00
echo " -- Exceptions found in $SERVLET_LOGS/ -- "
cat /tmp/t
echo
2019-10-15 07:57:38 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
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
if [ $DISTRIB_ID == "Ubuntu" ]; then
2017-02-21 03:11:22 +08:00
rm -rf /tmp/t
2019-03-14 22:19:13 +08:00
$SUDO grep --directories=skip -i exception /var/log/syslog > /tmp/t
if [ -s /tmp/t ]; then
echo " -- Errors found in /var/log/syslog -- "
cat /tmp/t
echo
fi
fi
rm -rf /tmp/t
if [ -d /var/log/bigbluebutton ]; then
$SUDO grep --directories=skip ERROR /var/log/bigbluebutton/* > /tmp/t
if [ -s /tmp/t ]; then
echo " -- Errors found in /var/log/bigbluebutton -- "
cat /tmp/t
echo
fi
fi
rm -rf /tmp/t
if [ -d /var/log/bigbluebutton ]; then
$SUDO grep --directories=skip -i exception /var/log/bigbluebutton/* > /tmp/t
if [ -s /tmp/t ]; then
echo " -- Exceptions found in /var/log/bigbluebutton -- "
cat /tmp/t
echo
2017-02-21 03:11:22 +08:00
fi
2019-03-14 22:19:13 +08:00
fi
#
# Additional checks for record and playback
#
if [ -f /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml ]; then
bbb-record --check
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
exit 0
2017-02-21 03:11:22 +08:00
fi
# if asked to print the version that's all we do
if [ -n "$HOST" ]; then
2019-10-31 23:47:07 +08:00
need_root
2019-03-14 22:19:13 +08:00
#
# Update configuration for BigBlueButton web app
#
2021-02-23 19:48:26 +08:00
echo "Assigning $HOST for web application URL in $BBB_WEB_ETC_CONFIG"
2021-03-06 04:56:50 +08:00
if [ -f "$BBB_WEB_ETC_CONFIG" ] && grep "bigbluebutton.web.serverURL" "$BBB_WEB_ETC_CONFIG" > /dev/null ; then
2021-02-23 19:48:26 +08:00
change_var_value "$BBB_WEB_ETC_CONFIG" bigbluebutton.web.serverURL "$PROTOCOL://$HOST"
else
2022-04-12 03:07:11 +08:00
echo "bigbluebutton.web.serverURL=$PROTOCOL://$HOST" >> "$BBB_WEB_ETC_CONFIG"
2021-02-23 19:48:26 +08:00
fi
2017-07-14 22:33:30 +08:00
2022-04-28 08:57:40 +08:00
# Populate /etc/bigbluebutton/bbb-web.properites with the shared secret
if ! grep -q "^securitySalt" "$BBB_WEB_ETC_CONFIG"; then
echo "securitySalt=$(get_bbb_web_config_value securitySalt)" >> "$BBB_WEB_ETC_CONFIG"
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
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
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
#
# Update bbb-apps-akka
#
2021-02-20 00:18:11 +08:00
echo "Assigning $HOST for web application URL in /etc/bigbluebutton/bbb-apps-akka.conf"
2019-03-14 22:19:13 +08:00
2021-02-20 00:18:11 +08:00
if [ -f /etc/bigbluebutton/bbb-apps-akka.conf ]; then
2019-03-14 22:19:13 +08:00
sed -i "s/bbbWebAPI[ ]*=[ ]*\"[^\"]*\"/bbbWebAPI=\"${PROTOCOL}:\/\/$HOST\/bigbluebutton\/api\"/g" \
2021-02-20 00:18:11 +08:00
/etc/bigbluebutton/bbb-apps-akka.conf
# Fix to ensure bbb-apps-akka.conf has the latest shared secret
2021-04-03 21:17:44 +08:00
SECRET=$(get_bbb_web_config_value securitySalt)
2019-03-14 22:19:13 +08:00
sed -i "s/sharedSecret[ ]*=[ ]*\"[^\"]*\"/sharedSecret=\"$SECRET\"/g" \
2021-02-20 00:18:11 +08:00
/etc/bigbluebutton/bbb-apps-akka.conf
2019-03-14 22:19:13 +08:00
fi
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
if [ -f ${LTI_DIR}/WEB-INF/classes/lti-config.properties ]; then
echo "Assigning $HOST for LTI integration in ${LTI_DIR}/WEB-INF/classes/lti-config.properties"
# We don't wat to guess on http/https as the lti endpoint may be a different BigBlueButton server
sed -i "s/bigbluebuttonURL=http:\/\/.*/bigbluebuttonURL=http:\/\/$HOST\/bigbluebutton/g" \
${LTI_DIR}/WEB-INF/classes/lti-config.properties
sed -i "s/bigbluebuttonURL=https:\/\/.*/bigbluebuttonURL=https:\/\/$HOST\/bigbluebutton/g" \
${LTI_DIR}/WEB-INF/classes/lti-config.properties
sed -i "s/ltiEndPoint=.*/ltiEndPoint=$HOST/g" \
${LTI_DIR}/WEB-INF/classes/lti-config.properties
fi
2018-01-16 01:11:05 +08:00
2018-10-23 04:27:46 +08:00
2019-03-14 22:19:13 +08:00
if [ -f /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml ]; then
echo "Assigning $HOST for record and playback in /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml"
2019-11-01 00:14:24 +08:00
change_yml_value /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml playback_host $HOST
fi
if [ -f /usr/local/bigbluebutton/bbb-webhooks/config/default.yml ]; then
echo "Assigning $HOST for webhooks in /usr/local/bigbluebutton/bbb-webhooks/config/default.yml"
change_yml_value /usr/local/bigbluebutton/bbb-webhooks/config/default.yml serverDomain $HOST
2019-03-14 22:19:13 +08:00
fi
2018-10-23 04:27:46 +08:00
2019-03-14 22:19:13 +08:00
echo -n "Assigning $HOST for playback of recordings: "
2022-11-11 09:51:46 +08:00
for metadata in $(find -L /var/bigbluebutton/published /var/bigbluebutton/unpublished -name metadata.xml); do
2019-03-14 22:19:13 +08:00
echo -n "."
# Ensure we update both types of URLs
2021-06-29 19:11:03 +08:00
xmlstarlet edit --inplace --update '//link[starts-with(normalize-space(), "https://")]' --expr "concat(\"https://\", \"$HOST/\", substring-after(substring-after(., \"https://\"),\"/\"))" $metadata
xmlstarlet edit --inplace --update '//link[starts-with(normalize-space(), "http://")]' --expr "concat(\"http://\", \"$HOST/\", substring-after(substring-after(., \"http://\"),\"/\"))" $metadata
2019-07-11 18:47:30 +08:00
#
# Update thumbnail links
#
2021-06-29 19:11:03 +08:00
xmlstarlet edit --inplace --update '//images/image[starts-with(normalize-space(), "https://")]' --expr "concat(\"https://\", \"$HOST/\", substring-after(substring-after(., \"https://\"),\"/\"))" $metadata
xmlstarlet edit --inplace --update '//images/image[starts-with(normalize-space(), "http://")]' --expr "concat(\"http://\", \"$HOST/\", substring-after(substring-after(., \"http://\"),\"/\"))" $metadata
2019-03-14 22:19:13 +08:00
done
echo
#
# Update HTML5 client
#
2021-06-09 17:50:54 +08:00
if [ -f $HTML5_DEFAULT_CONFIG ]; then
yq w -i $HTML5_DEFAULT_CONFIG public.kurento.wsUrl "wss://$HOST/bbb-webrtc-sfu"
2022-02-20 00:44:42 +08:00
yq w -i $HTML5_DEFAULT_CONFIG public.pads.url "$PROTOCOL://$HOST/pad"
2021-06-09 17:50:54 +08:00
chown meteor:meteor $HTML5_DEFAULT_CONFIG
2019-03-14 22:19:13 +08:00
fi
2020-09-15 05:19:46 +08:00
#
# Update ESL passwords in three configuration files
#
2021-02-21 00:58:03 +08:00
ESL_PASSWORD=$(cat /etc/bigbluebutton/bbb-fsesl-akka.conf | grep password | head -n 1 | sed 's/.*="//g' | sed 's/"//g')
2020-06-07 23:48:25 +08:00
if [ "$ESL_PASSWORD" == "ClueCon" ]; then
2020-07-01 01:17:12 +08:00
ESL_PASSWORD=$(openssl rand -hex 8)
2021-02-21 00:58:03 +08:00
sudo sed -i "s/ClueCon/$ESL_PASSWORD/g" /etc/bigbluebutton/bbb-fsesl-akka.conf
2020-06-07 23:48:25 +08:00
fi
2020-07-01 01:17:12 +08:00
sudo yq w -i /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml freeswitch.esl_password "$ESL_PASSWORD"
2020-09-15 05:19:46 +08:00
sudo xmlstarlet edit --inplace --update 'configuration/settings//param[@name="password"]/@value' --value $ESL_PASSWORD /opt/freeswitch/etc/freeswitch/autoload_configs/event_socket.conf.xml
2020-07-01 01:17:12 +08:00
2020-06-07 23:48:25 +08:00
2022-07-08 01:19:09 +08:00
echo "Restarting BigBlueButton $BIGBLUEBUTTON_RELEASE ..."
2023-01-10 23:00:01 +08:00
stop_bigbluebutton
start_bigbluebutton
2019-03-14 22:19:13 +08:00
exit 0
2017-02-21 03:11:22 +08:00
fi
if [ $RESTART ]; then
2019-03-14 22:19:13 +08:00
need_root
check_configuration
echo "Restarting BigBlueButton $BIGBLUEBUTTON_RELEASE ..."
2023-01-10 23:00:01 +08:00
stop_bigbluebutton
start_bigbluebutton
2019-03-14 22:19:13 +08:00
check_state
2017-02-21 03:11:22 +08:00
fi
if [ $CLEAN ]; then
2019-03-14 22:19:13 +08:00
need_root
check_configuration
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
echo "Restarting BigBlueButton $BIGBLUEBUTTON_RELEASE (and cleaning out all log files) ..."
stop_bigbluebutton
2017-02-21 03:11:22 +08:00
2019-03-14 22:19:13 +08:00
#
# Clean log files
#
2015-08-23 11:29:13 +08:00
2019-03-14 22:19:13 +08:00
echo " ... cleaning log files"
rm -f /var/log/bigbluebutton/*.log
2018-12-10 04:47:13 +08:00
2019-03-14 22:19:13 +08:00
rm -f /opt/freeswitch/var/log/freeswitch/*.log
2019-03-27 01:02:38 +08:00
rm -f /opt/freeswitch/var/log/freeswitch/*.log.*
2018-12-10 04:47:13 +08:00
2019-03-14 22:19:13 +08:00
#
# Clean out the log files for record and playback
#
rm -f /var/log/bigbluebutton/bbb-rap-worker.log*
2019-12-05 02:35:08 +08:00
rm -f /var/log/bigbluebutton/bbb-rap-resque.log*
2019-03-14 22:19:13 +08:00
rm -f /var/log/bigbluebutton/archive.log*
if [ -d /var/log/bigbluebutton/html5 ]; then
rm -f /var/log/bigbluebutton/html5/*
fi
if [ -d /var/log/bigbluebutton/podcast ]; then
rm -f /var/log/bigbluebutton/podcast/*
fi
if [ -d /var/log/bigbluebutton/presentation ]; then
rm -f /var/log/bigbluebutton/presentation/*
fi
if [[ $SERVLET_LOGS ]]; then
rm -rf $SERVLET_LOGS/*
fi
2019-11-10 01:44:03 +08:00
# Check if we are storing HTML5 logs in the server
HTML5_SERVER_LOG=0
if [[ -f /var/log/nginx/html5-client.log ]]; then
HTML5_SERVER_LOG=1
fi
2019-03-14 22:19:13 +08:00
rm -rf /var/log/nginx/*
2019-11-10 01:44:03 +08:00
# Revert HTML5 client logs to their original permissions
if [ $HTML5_SERVER_LOG ]; then
touch /var/log/nginx/html5-client.log
chown www-data:adm /var/log/nginx/html5-client.log
chmod 640 /var/log/nginx/html5-client.log
fi
2019-03-27 01:02:38 +08:00
if [ -d /var/log/bbb-fsesl-akka ]; then
rm -f /var/log/bbb-fsesl-akka/*
fi
2019-03-14 22:19:13 +08:00
2020-12-19 07:38:46 +08:00
if [ -d /var/log/bbb-apps-akka ]; then
2019-03-27 01:02:38 +08:00
rm -f /var/log/bbb-apps-akka/*
fi
if [ -d /var/log/bbb-webrtc-sfu ]; then
rm -f /var/log/bbb-webrtc-sfu/*
fi
if [ -d /var/log/redis ]; then
rm -f /var/log/redis/*
fi
if [ -d /var/log/mongodb ]; then
rm -f /var/log/mongodb/*
fi
if [ -d /var/log/kurento-media-server ]; then
rm -f /var/log/kurento-media-server/*
fi
2019-03-14 22:19:13 +08:00
start_bigbluebutton
check_state
2017-02-21 03:11:22 +08:00
fi
if [ $NETWORK ]; then
2022-03-24 04:50:19 +08:00
ss -ant | egrep ":80|:443\ " | egrep -v ":::|0.0.0.0" > /tmp/t_net
2019-03-14 22:19:13 +08:00
REMOTE=$(cat /tmp/t_net | cut -c 45-68 | cut -d ":" -f1 | sort | uniq)
if [ "$REMOTE" != "" ]; then
2022-03-24 04:50:19 +08:00
echo -e "ss\t\t\t80\t443"
2019-03-14 22:19:13 +08:00
for IP in $REMOTE ; do
PORT_80=$(cat /tmp/t_net | grep :80 | cut -c 45-68 | cut -d ":" -f1 | grep $IP | wc -l )
2021-06-09 17:50:54 +08:00
PORT_443=$(cat /tmp/t_net | grep :443 | cut -c 45-68 | cut -d ":" -f1 | grep $IP | wc -l )
2019-03-14 22:19:13 +08:00
2020-12-19 08:47:59 +08:00
echo -e "$IP\t\t$PORT_80\t$PORT_443"
2019-03-14 22:19:13 +08:00
done
fi
2020-05-20 16:21:26 +08:00
rm /tmp/t_net
2017-02-21 03:11:22 +08:00
fi
2009-12-13 22:34:01 +08:00
2017-02-21 03:11:22 +08:00
if [ $WATCH ]; then
2019-03-14 22:19:13 +08:00
need_root
watch -n 2 "top -n 1 -b | head -n 5; echo; bbb-conf --network; bbb-conf --debug"
2017-02-21 03:11:22 +08:00
fi