273 lines
7.4 KiB
Bash
Executable File
273 lines
7.4 KiB
Bash
Executable File
#!/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
|
|
|
|
|
|
set -e
|
|
#set -x
|
|
|
|
BASE=/var/bigbluebutton/recording
|
|
STATUS=$BASE/status
|
|
|
|
TYPES=$(cd /usr/local/bigbluebutton/core/scripts/process; ls *.rb | sed s/.rb//g)
|
|
|
|
mark_for_rebuild() {
|
|
MEETING_ID=$1
|
|
for type in $TYPES; do
|
|
if [ -d $BASE/process/$type/$MEETING_ID ]; then
|
|
rm -rf $BASE/process/$type/$MEETING_ID
|
|
else
|
|
echo "Warn: Didn't find $BASE/process/$type/$MEETING_ID"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f $STATUS/processed/$MEETING_ID-$type.done ]; then
|
|
rm $STATUS/processed/$MEETING_ID-$type.done
|
|
else
|
|
echo "Warn: Didn't find $STATUS/processed/$MEETING_ID-$type.done"
|
|
exit 1
|
|
fi
|
|
|
|
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
|
|
done
|
|
}
|
|
|
|
BBB_VERSION=0.8-dev
|
|
|
|
need_root() {
|
|
if [ $EUID != 0 ]; then
|
|
echo "Need to be root to run this option"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
usage() {
|
|
echo "BigBlueButton Recording Utility - Version $BBB_VERSION"
|
|
echo
|
|
echo " bbb-record [options]"
|
|
echo
|
|
echo "Configuration:"
|
|
echo " --version Display BigBlueButton version (packages)"
|
|
echo
|
|
echo "Monitoring:"
|
|
echo " --watch watch the processing in real-time"
|
|
echo " --rebuild [meetingID] rebuild the output for meetingID"
|
|
echo " --deletall delete all meetings and recordings"
|
|
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
|
|
if [ "$1" = "-rebuild" -o "$1" = "--rebuild" ]; then
|
|
need_root
|
|
if [ ! -z "${2}" ]; then
|
|
MEETING_ID="${2}"
|
|
shift
|
|
fi
|
|
REBUILD=1
|
|
shift
|
|
continue
|
|
fi
|
|
usage
|
|
if [ "$1" = "-deleteall" -o "$1" = "--deleteall" ]; then
|
|
need_root
|
|
DELETEALL=1
|
|
shift
|
|
continue
|
|
fi
|
|
usage
|
|
exit 1
|
|
done
|
|
|
|
if [ $REBUILD ]; then
|
|
if [ -z "$MEETING_ID" ]; then
|
|
#
|
|
# Regenerate all meetings
|
|
#
|
|
for recording in $(dir $BASE/raw); do
|
|
echo "Marking for rebuild: $MEETING_ID"
|
|
mark_for_rebuild $MEETING_ID
|
|
|
|
#sudo rm -rf /var/bigbluebutton/recording/process/slides/6e35e3b2778883f5db637d7a5dba0a427f692e91-1314313817423
|
|
#sudo rm /var/bigbluebutton/recording/status/processed/6e35e3b2778883f5db637d7a5dba0a427f692e91-1314313817423-slides.done
|
|
|
|
#rm -rf $BASE/recording/process/slides/$recording
|
|
#rm -rf $BASE/publish/slides/$recording
|
|
|
|
#if [ -d /var/bigbluebutton/published/$recording ]; then
|
|
# rm -rf /var/bigbluebutton/published/$recording
|
|
#fi
|
|
#if [ -d /var/bigbluebutton/unpublished/$recording ]; then
|
|
# rm -rf /var/bigbluebutton/unpublished/$recording
|
|
#fi
|
|
done
|
|
else
|
|
echo "Marking for rebuild: $MEETING_ID"
|
|
mark_for_rebuild $MEETING_ID
|
|
|
|
fi
|
|
fi
|
|
|
|
if [ $DELETEALL ]; then
|
|
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/*
|
|
|
|
rm -rf /var/log/bigbluebutton/$type/*
|
|
done
|
|
|
|
rm -f /var/bigbluebutton/recording/status/recorded/*
|
|
rm -f /var/bigbluebutton/recording/status/archived/*
|
|
rm -f /var/bigbluebutton/recording/status/processed/*
|
|
|
|
for meeting in $(ls /var/bigbluebutton | grep "[0-9]\{13\}$"); do
|
|
echo "deleting: $meeting"
|
|
rm -rf /var/bigbluebutton/$meeting
|
|
done
|
|
fi
|
|
|
|
if [ $WATCH ]; then
|
|
|
|
|
|
#ps -fC god
|
|
#ps -uxfp $(cat /var/run/god.pid)
|
|
#RAP_PID=$(ps -fC ruby | grep rap-worker | awk '{print $2}')
|
|
#if [ "$RAP_PID" != "" ]; then
|
|
#echo
|
|
#ps fU tomcat6 -o "%c%a"
|
|
#ps af -C tomcat6 -o "%c%a"
|
|
# pstree --ascii -alp $RAP_PID
|
|
#fi
|
|
|
|
|
|
echo "MeetingID Time Slides Recorded Archived Processed Published Description"
|
|
echo "------------------------------------------------------ ---------------------------- ------ -------- -------- -------------------- -------------------- -----------------------------"
|
|
|
|
for meeting in $(ls -u /var/bigbluebutton | grep "[0-9]\{13\}$"); do
|
|
echo -n "$meeting"
|
|
timestamp=$(echo $meeting | sed s/.*-//g)
|
|
epoc=$(($timestamp/1000))
|
|
echo -n " "
|
|
echo -n $(date --date "Jan 1, 1970 00:00:00 +0000 + $epoc seconds")
|
|
|
|
printf "%7s" $(find /var/bigbluebutton/$meeting/$meeting -name "*.swf" | wc -l)
|
|
#echo "/var/bigbluebutton/$meeting/$meeting"
|
|
|
|
#echo $BASE/raw/$meeting
|
|
if [ -d $BASE/raw/$meeting ]; then
|
|
recording=$meeting
|
|
|
|
#for recording in $(dir $BASE/raw); do
|
|
|
|
#echo -n "$recording: "
|
|
|
|
#
|
|
# Check archived
|
|
if [ -f $STATUS/recorded/$recording.done ]; then
|
|
echo -n " done "
|
|
else
|
|
echo -n " "
|
|
fi
|
|
|
|
|
|
#
|
|
# Check archived
|
|
if [ -f $STATUS/archived/$recording.done ]; then
|
|
echo -n " done "
|
|
else
|
|
echo -n " "
|
|
fi
|
|
|
|
|
|
#
|
|
# Check archived
|
|
processed=""
|
|
for type in $TYPES; do
|
|
if [ -f $STATUS/processed/$recording-$type.done ]; then
|
|
if [ ! -z "$processed" ]; then
|
|
processed="$processed,"
|
|
fi
|
|
processed="$processed$type"
|
|
fi
|
|
done
|
|
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
|
|
|
|
|
|
if [ -f /var/bigbluebutton/recording/raw/$recording/events.xml ]; then
|
|
echo -n " "
|
|
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
|
|
|
|
|