#!/bin/sh now=$(date) echo "======================" echo "Current Date: $now" bbb-conf --clean echo "======================" MAXAGE=15 LOGFILE=/var/log/bigbluebutton/bbb-recording-cleanup.log shopt -s nullglob NOW=$(date +%s) echo "$(date --rfc-3339=seconds) Deleting recordings older than ${MAXAGE} days" >>"${LOGFILE}" for donefile in /var/bigbluebutton/recording/status/published/*-presentation.don e ; do MTIME=$(stat -c %Y "${donefile}") # Check the age of the recording if [ $(( ( $NOW - $MTIME ) / 86400 )) -gt $MAXAGE ]; then MEETING_ID=$(basename "${donefile}") MEETING_ID=${MEETING_ID%-presentation.done} echo "${MEETING_ID}" >> "${LOGFILE}" bbb-record --delete "${MEETING_ID}" >>"${LOGFILE}" fi done for eventsfile in /var/bigbluebutton/recording/raw/*/events.xml ; do MTIME=$(stat -c %Y "${eventsfile}") # Check the age of the recording if [ $(( ( $NOW - $MTIME ) / 86400 )) -gt $MAXAGE ]; then MEETING_ID="${eventsfile%/events.xml}" MEETING_ID="${MEETING_ID##*/}" echo "${MEETING_ID}" >> "${LOGFILE}" bbb-record --delete "${MEETING_ID}" >>"${LOGFILE}" fi done