2011-08-26 06:47:03 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2008-2011 by BigBlueButton Inc.
|
|
|
|
#
|
|
|
|
# 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 2 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
|
|
|
|
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# Author(s):
|
|
|
|
# Fred Dixon <ffdixon@bigbluebutton.org>
|
|
|
|
#
|
|
|
|
# Changelog:
|
|
|
|
# 2011-08-18 FFD Inital Version
|
2011-11-20 22:33:55 +08:00
|
|
|
# 2011-11-20 FFD Added more checks for processing of recording
|
2011-08-26 06:47:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
#set -x
|
|
|
|
|
|
|
|
BASE=/var/bigbluebutton/recording
|
|
|
|
STATUS=$BASE/status
|
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
RECORDING_DIR=$(cat /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | sed -n '/\(recording_dir\)/{s/.*recording_dir:[ ]*//;s/;//;p}')
|
|
|
|
PUBLISHED_DIR=$(cat /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | sed -n '/\(published_dir\)/{s/.*published_dir:[ ]*//;s/;//;p}')
|
|
|
|
RAW_AUDIO_SRC=$(cat /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | sed -n '/\(raw_audio_src\)/{s/.*raw_audio_src:[ ]*//;s/;//;p}')
|
|
|
|
RAW_VIDEO_SRC=$(cat /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | sed -n '/\(raw_video_src\)/{s/.*raw_video_src:[ ]*//;s/;//;p}')
|
|
|
|
RAW_DESKSHARE_SRC=$(cat /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | sed -n '/\(raw_deskshare_src\)/{s/.*raw_deskshare_src:[ ]*//;s/;//;p}')
|
|
|
|
RAW_PRESENTATION_SRC=$(cat /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | sed -n '/\(raw_presentation_src\)/{s/.*raw_presentation_src:[ ]*//;s/;//;p}')
|
|
|
|
|
2011-08-31 04:12:37 +08:00
|
|
|
TYPES=$(cd /usr/local/bigbluebutton/core/scripts/process; ls *.rb | sed s/.rb//g)
|
|
|
|
|
|
|
|
mark_for_rebuild() {
|
|
|
|
MEETING_ID=$1
|
2011-09-01 05:45:38 +08:00
|
|
|
set -x
|
2011-08-31 04:12:37 +08:00
|
|
|
for type in $TYPES; do
|
|
|
|
if [ -d $BASE/process/$type/$MEETING_ID ]; then
|
|
|
|
rm -rf $BASE/process/$type/$MEETING_ID
|
2011-09-10 21:35:32 +08:00
|
|
|
# else
|
|
|
|
# echo "Warn: Didn't find $BASE/process/$type/$MEETING_ID"
|
|
|
|
# exit 1
|
2011-08-31 04:12:37 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f $STATUS/processed/$MEETING_ID-$type.done ]; then
|
|
|
|
rm $STATUS/processed/$MEETING_ID-$type.done
|
2011-09-10 21:35:32 +08:00
|
|
|
# else
|
|
|
|
# echo "Warn: Didn't find $STATUS/processed/$MEETING_ID-$type.done"
|
|
|
|
# exit 1
|
2011-08-31 04:12:37 +08:00
|
|
|
fi
|
2011-09-01 02:55:20 +08:00
|
|
|
|
2011-09-01 05:45:38 +08:00
|
|
|
if [ -d $BASE/publish/$type/$MEETING_ID ]; then
|
|
|
|
rm -rf $BASE/publish/$type/$MEETING_ID
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /var/bigbluebutton/processed/$type/$MEETING_ID ]; then
|
|
|
|
rm -rf /var/bigbluebutton/published/$type/$MEETING_ID
|
|
|
|
fi
|
|
|
|
|
2011-09-01 02:55:20 +08:00
|
|
|
if [ -d /var/bigbluebutton/published/$type/$MEETING_ID ]; then
|
|
|
|
rm -rf /var/bigbluebutton/published/$type/$MEETING_ID
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /var/bigbluebutton/unpublished/$type/$MEETING_ID ]; then
|
|
|
|
rm -rf /var/bigbluebutton/unpublished/$type/$MEETING_ID
|
|
|
|
fi
|
2011-08-31 04:12:37 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
BBB_VERSION=0.8-beta-3
|
2011-08-26 06:47:03 +08:00
|
|
|
|
|
|
|
need_root() {
|
|
|
|
if [ $EUID != 0 ]; then
|
|
|
|
echo "Need to be root to run this option"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
usage() {
|
2011-11-20 22:33:55 +08:00
|
|
|
echo "BigBlueButton Recording Diagnostic Utility - Version $BBB_VERSION"
|
2011-08-26 06:47:03 +08:00
|
|
|
echo
|
|
|
|
echo " bbb-record [options]"
|
|
|
|
echo
|
|
|
|
echo "Configuration:"
|
|
|
|
echo " --version Display BigBlueButton version (packages)"
|
|
|
|
echo
|
2011-09-10 21:35:32 +08:00
|
|
|
echo "Reporting:"
|
|
|
|
echo " --list List all recordings"
|
|
|
|
echo
|
2011-08-26 06:47:03 +08:00
|
|
|
echo "Monitoring:"
|
2011-09-10 21:35:32 +08:00
|
|
|
echo " --watch Watch processing of recordings"
|
2011-08-31 04:12:37 +08:00
|
|
|
echo " --rebuild [meetingID] rebuild the output for meetingID"
|
2011-09-01 02:55:20 +08:00
|
|
|
echo " --deletall delete all meetings and recordings"
|
2011-08-26 06:47:03 +08:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Parse the parameters
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
if [ "$1" = "-watch" -o "$1" = "--watch" ]; then
|
|
|
|
WATCH=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
fi
|
2011-09-10 21:35:32 +08:00
|
|
|
if [ "$1" = "-list" -o "$1" = "--list" ]; then
|
|
|
|
LIST=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
fi
|
2011-09-12 05:11:50 +08:00
|
|
|
if [ "$1" = "--list20" ]; then
|
2011-09-10 21:35:32 +08:00
|
|
|
LIST=1
|
|
|
|
HEAD=20
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
fi
|
2011-08-26 06:47:03 +08:00
|
|
|
if [ "$1" = "-rebuild" -o "$1" = "--rebuild" ]; then
|
|
|
|
need_root
|
2011-08-31 04:12:37 +08:00
|
|
|
if [ ! -z "${2}" ]; then
|
|
|
|
MEETING_ID="${2}"
|
|
|
|
shift
|
|
|
|
fi
|
2011-08-26 06:47:03 +08:00
|
|
|
REBUILD=1
|
|
|
|
shift
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
usage
|
2011-09-01 02:55:20 +08:00
|
|
|
if [ "$1" = "-deleteall" -o "$1" = "--deleteall" ]; then
|
2011-08-26 06:47:03 +08:00
|
|
|
need_root
|
2011-09-01 02:55:20 +08:00
|
|
|
DELETEALL=1
|
2011-08-26 06:47:03 +08:00
|
|
|
shift
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $REBUILD ]; then
|
2011-08-31 04:12:37 +08:00
|
|
|
if [ -z "$MEETING_ID" ]; then
|
2011-08-26 06:47:03 +08:00
|
|
|
#
|
2011-08-31 04:12:37 +08:00
|
|
|
# Regenerate all meetings
|
|
|
|
#
|
|
|
|
for recording in $(dir $BASE/raw); do
|
|
|
|
echo "Marking for rebuild: $MEETING_ID"
|
|
|
|
mark_for_rebuild $MEETING_ID
|
|
|
|
done
|
|
|
|
else
|
2011-11-20 22:33:55 +08:00
|
|
|
echo "Marking for rebuild: $MEETING_ID"
|
|
|
|
mark_for_rebuild $MEETING_ID
|
2011-08-31 04:12:37 +08:00
|
|
|
fi
|
|
|
|
fi
|
2011-08-26 06:47:03 +08:00
|
|
|
|
2011-09-01 02:55:20 +08:00
|
|
|
if [ $DELETEALL ]; then
|
2011-08-31 04:12:37 +08:00
|
|
|
for type in $TYPES; do
|
|
|
|
rm -rf /var/bigbluebutton/published/$type/*
|
|
|
|
rm -rf /var/bigbluebutton/unpublished/$type/*
|
|
|
|
|
|
|
|
rm -rf /var/bigbluebutton/recording/process/$type/*
|
|
|
|
rm -rf /var/bigbluebutton/recording/publish/$type/*
|
|
|
|
|
|
|
|
rm -rf /var/bigbluebutton/recording/raw/*
|
2011-09-01 02:55:20 +08:00
|
|
|
|
|
|
|
rm -rf /var/log/bigbluebutton/$type/*
|
2011-08-31 04:12:37 +08:00
|
|
|
done
|
2011-08-26 06:47:03 +08:00
|
|
|
|
2011-09-01 02:55:20 +08:00
|
|
|
rm -f /var/bigbluebutton/recording/status/recorded/*
|
|
|
|
rm -f /var/bigbluebutton/recording/status/archived/*
|
|
|
|
rm -f /var/bigbluebutton/recording/status/processed/*
|
2011-08-26 06:47:03 +08:00
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
rm -f /usr/share/red5/webapps/video/streams/*.flv
|
|
|
|
rm -f /var/bigbluebutton/deskshare/*.flv
|
|
|
|
|
2011-08-26 06:47:03 +08:00
|
|
|
for meeting in $(ls /var/bigbluebutton | grep "[0-9]\{13\}$"); do
|
|
|
|
echo "deleting: $meeting"
|
2011-09-01 02:55:20 +08:00
|
|
|
rm -rf /var/bigbluebutton/$meeting
|
2011-08-26 06:47:03 +08:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2011-09-10 21:35:32 +08:00
|
|
|
if [ $LIST ]; then
|
2011-08-26 06:47:03 +08:00
|
|
|
|
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
echo "MeetingID Time APVD APVDE RA Slides Processed Published Description"
|
|
|
|
echo "------------------------------------------------------ ---------------------------- ---- ----- -- ------ -------------------- -------------------- -----------------------------"
|
2011-09-10 21:35:32 +08:00
|
|
|
|
|
|
|
if [ -z $HEAD ]; then
|
|
|
|
# If we're not called with --list20, show all recordings
|
|
|
|
HEAD=99999
|
|
|
|
fi
|
2011-08-31 04:12:37 +08:00
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
for meeting in $(ls -t /var/bigbluebutton | grep "[0-9]\{13\}$" | head -n $HEAD); do
|
2011-08-26 06:47:03 +08:00
|
|
|
echo -n "$meeting"
|
2011-08-31 04:12:37 +08:00
|
|
|
timestamp=$(echo $meeting | sed s/.*-//g)
|
|
|
|
epoc=$(($timestamp/1000))
|
|
|
|
echo -n " "
|
2011-09-10 21:35:32 +08:00
|
|
|
echo -n $(date --date "Jan 1, 1970 00:00:00 +0000 + $epoc seconds") | awk '{ printf("%-28s",$0) }'
|
2011-11-20 22:33:55 +08:00
|
|
|
echo -n " "
|
|
|
|
|
|
|
|
#
|
|
|
|
# Monitor the live recordings
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check if there is any recorded audio
|
|
|
|
if ls -A $RAW_AUDIO_SRC/$meeting-*.wav &> /dev/null; then
|
|
|
|
echo -n "X"
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
2011-08-26 06:47:03 +08:00
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
#
|
|
|
|
# Check if there area uploaded presentations
|
|
|
|
if [ -d $RAW_PRESENTATION_SRC/$meeting/$meeting ]; then
|
|
|
|
if [ "$(ls -A $RAW_PRESENTATION_SRC/$meeting/$meeting)" ]; then
|
|
|
|
echo -n "X"
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
2011-08-26 06:47:03 +08:00
|
|
|
|
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
#
|
|
|
|
# Check if there is any recorded videos
|
|
|
|
if [ -d $RAW_VIDEO_SRC/$meeting ]; then
|
|
|
|
if [ "$(ls -A $RAW_VIDEO_SRC/$meeting)" ]; then
|
|
|
|
echo -n "X"
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
2011-08-26 06:47:03 +08:00
|
|
|
|
|
|
|
#
|
2011-11-20 22:33:55 +08:00
|
|
|
# Check if there is any recorded desktop sharing
|
|
|
|
if ls -A $RAW_DESKSHARE_SRC/$meeting-*.flv &> /dev/null; then
|
|
|
|
echo -n "X"
|
2011-08-26 06:47:03 +08:00
|
|
|
else
|
2011-11-20 22:33:55 +08:00
|
|
|
echo -n " "
|
2011-08-26 06:47:03 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#
|
2011-11-20 22:33:55 +08:00
|
|
|
# Monitor the archived files
|
|
|
|
#
|
|
|
|
RAW_DIR=$RAW_PRESENTATION_SRC/recording/raw/$meeting
|
|
|
|
echo -n " "
|
|
|
|
|
|
|
|
# Check if there area uploaded presentations
|
|
|
|
#echo "$RAW/audio"
|
|
|
|
DIRS="audio presentation video deskshare"
|
|
|
|
for dir in $DIRS; do
|
|
|
|
if [ -d $RAW_DIR/$dir ]; then
|
|
|
|
if [ "$(ls -A $RAW_DIR/$dir)" ]; then
|
|
|
|
echo -n "X"
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -f $RAW_DIR/events.xml ]; then
|
|
|
|
echo -n "X"
|
2011-08-26 06:47:03 +08:00
|
|
|
else
|
2011-11-20 22:33:55 +08:00
|
|
|
echo -n " "
|
2011-08-26 06:47:03 +08:00
|
|
|
fi
|
|
|
|
|
2011-11-20 22:33:55 +08:00
|
|
|
#
|
|
|
|
# Check the status files
|
|
|
|
#
|
|
|
|
echo -n " "
|
|
|
|
STATUS_DIR=$RAW_PRESENTATION_SRC/recording/status
|
|
|
|
DIRS="recorded archived"
|
|
|
|
for dir in $DIRS; do
|
|
|
|
if [ -f $STATUS_DIR/$dir/$meeting.done ]; then
|
|
|
|
echo -n "X"
|
|
|
|
else
|
|
|
|
echo -n " "
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
#
|
|
|
|
# Numbe rof slides
|
|
|
|
printf "%7s" $(find /var/bigbluebutton/$meeting/$meeting -name "*.swf" | wc -l)
|
|
|
|
|
|
|
|
|
|
|
|
echo -n " "
|
|
|
|
#echo $BASE/raw/$meeting
|
|
|
|
if [ -d $BASE/raw/$meeting ]; then
|
|
|
|
recording=$meeting
|
2011-08-26 06:47:03 +08:00
|
|
|
|
|
|
|
#
|
2011-11-20 22:33:55 +08:00
|
|
|
# Checka processed
|
2011-09-01 02:55:20 +08:00
|
|
|
processed=""
|
2011-08-31 04:12:37 +08:00
|
|
|
for type in $TYPES; do
|
|
|
|
if [ -f $STATUS/processed/$recording-$type.done ]; then
|
2011-09-01 02:55:20 +08:00
|
|
|
if [ ! -z "$processed" ]; then
|
|
|
|
processed="$processed,"
|
2011-08-31 04:12:37 +08:00
|
|
|
fi
|
2011-09-01 02:55:20 +08:00
|
|
|
processed="$processed$type"
|
2011-08-31 04:12:37 +08:00
|
|
|
fi
|
|
|
|
done
|
2011-09-01 02:55:20 +08:00
|
|
|
printf "%-21s" $processed
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check archived
|
|
|
|
published=""
|
|
|
|
for type in $TYPES; do
|
|
|
|
if [ -f /var/bigbluebutton/published/$type/$recording/metadata.xml ]; then
|
|
|
|
if [ ! -z "$published" ]; then
|
|
|
|
published="$published,"
|
|
|
|
fi
|
|
|
|
published="$published$type"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
printf "%-17s" $published
|
|
|
|
|
2011-08-26 06:47:03 +08:00
|
|
|
|
|
|
|
if [ -f /var/bigbluebutton/recording/raw/$recording/events.xml ]; then
|
2011-08-31 04:12:37 +08:00
|
|
|
echo -n " "
|
2011-08-26 06:47:03 +08:00
|
|
|
echo -n $(head -n 5 /var/bigbluebutton/recording/raw/$recording/events.xml | grep description | sed s/.*description=\"//g | sed s/\".*//g)
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
echo "--"
|
|
|
|
ps fU tomcat6 -o "%c%a" | grep -v COMMAND | grep -v logging.properties
|
|
|
|
|
|
|
|
echo "--"
|
|
|
|
|
|
|
|
if tail -n 20 /var/log/bigbluebutton/bbb-web.log | grep -q "is recorded. Process it."; then
|
|
|
|
echo -n "Last meeting processed (bbb-web.log): "
|
|
|
|
tail -n 20 /var/log/bigbluebutton/bbb-web.log | grep "is recorded. Process it." | sed "s/.*\[//g" | sed "s/\].*//g"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2011-09-10 21:35:32 +08:00
|
|
|
if [ $WATCH ]; then
|
|
|
|
watch -n 2 "bbb-record --list20"
|
|
|
|
fi
|