Trying to delete old files cause not showing existing ones in Moodle and shows 404 error

30 views
Skip to first unread message

Hossein K

unread,
Nov 28, 2024, 7:43:30 PM11/28/24
to bigbluebutton-users
Hello
My setup is
Bigbluebutton 2.7.15 and moodle 4.1.14
On a dedicated server with domain correctly set for BBB and works for more than a year.

Recently I want to manage more on automatic deletion of recordings more than 30 days.
Unfortunately I create a script with help of chat GPT that I paste it below. 
after that I cannot see recordings showing in moodle anymore.

I use "bbb-record --rebuildall" the recordings and again and then I cannot see those newly created in BBB, in the the Moodle too. ( I check the internal and external IDs to determine and connect them, and then check the related activity in the Moodle)

Currenly I --rebuild recordings and they are exists in published directory.
Currently in moodle (after clear cache) there is no recordings showing in related course>activity.
Currenly in Greenlite, old recorings show in the list, but after clicking on them, URL redirects to IP instead of Domain, and shows " 404 not found - nginx". 

All newly recorded sessions are not now showing in moodle and Greenlite too.

How can I reconnect newly created published recordings to Moodle and Greenlite again ?

Kind Regards
*
Here is the script that I use and set a cronjob for it:  ( *** don't use this ***)


#!/bin/bash

# Number of days to keep recordings
DAYS_TO_KEEP=30

# Log file path
LOG_FILE="/var/log/bbb_delete_recordings.log"

# Current timestamp
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")

# Start logging
echo "[$TIMESTAMP] Starting deletion of recordings older than $DAYS_TO_KEEP days." >> $LOG_FILE

# Directories for deletion
DIRECTORIES=(
    "/var/bigbluebutton/unpublished/presentation"
    "/var/bigbluebutton/recording/raw"
    "/var/bigbluebutton/recording/publish"
    "/var/bigbluebutton/published/presentation"
    "/var/bigbluebutton/deleted/presentation"
    "/var/bigbluebutton/recording/status/archived"
    "/var/bigbluebutton/recording/status/ended"
    "/var/bigbluebutton/recording/status/processed"
    "/var/bigbluebutton/recording/status/published"
    "/var/bigbluebutton/recording/status/recorded"
    "/var/bigbluebutton/recording/status/sanity"
)

# Function to delete files and empty directories older than the specified number of days
delete_old_files_and_dirs() {
    local directory=$1
    TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
    echo "[$TIMESTAMP] Processing directory: $directory" >> $LOG_FILE
   
    # Delete files older than DAYS_TO_KEEP
    find "$directory" -type f -mtime +$DAYS_TO_KEEP -exec rm -f {} \; >> $LOG_FILE 2>&1
    if [ $? -eq 0 ]; then
        echo "[$TIMESTAMP] Files older than $DAYS_TO_KEEP days deleted from $directory." >> $LOG_FILE
    else
        echo "[$TIMESTAMP] Failed to delete files in $directory." >> $LOG_FILE
    fi

    # Delete empty directories
    find "$directory" -type d -empty -exec rm -rf {} \; >> $LOG_FILE 2>&1
    if [ $? -eq 0 ]; then
        echo "[$TIMESTAMP] Empty directories deleted from $directory." >> $LOG_FILE
    else
        echo "[$TIMESTAMP] Failed to delete empty directories in $directory." >> $LOG_FILE
    fi
}

# Loop through each directory and process deletions
for DIR in "${DIRECTORIES[@]}"; do
    if [ -d "$DIR" ]; then
        delete_old_files_and_dirs "$DIR"
    else
        TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
        echo "[$TIMESTAMP] Directory $DIR does not exist, skipping." >> $LOG_FILE
    fi
done

# Metadata cleanup with BigBlueButton tools
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
echo "[$TIMESTAMP] Starting metadata cleanup using bbb-record..." >> $LOG_FILE

# List all recordings and log the output
bbb-record --list >> $LOG_FILE 2>&1

# Purge recordings metadata
bbb-record --purge >> $LOG_FILE 2>&1
if [ $? -eq 0 ]; then
    echo "[$TIMESTAMP] Metadata cleanup completed successfully." >> $LOG_FILE
else
    echo "[$TIMESTAMP] Metadata cleanup failed." >> $LOG_FILE
fi

# Finish logging
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
echo "[$TIMESTAMP] Deletion process completed." >> $LOG_FILE

Jean Pluzo

unread,
Nov 29, 2024, 10:16:25 AM11/29/24
to bigbluebutton-users
Hi,

interesting. I wouldn't go and ask a LLM for a script, copy it and see what happens without first knowing exactly what the script does and testing it. But that's me.
You not only deleted the recordings with your script but also the raw files and everything else in case you would need to rebuild a recording in the future.
Perhaps you can see the last recordings (last 30 days), but I think something went wrong while syncing BBB to Moodle. For this you should check both Moodle logs and BBB logs. You will find more info there.

Regards,
J.

Hossein K

unread,
Dec 6, 2024, 8:55:19 AM12/6/24
to bigbluebu...@googlegroups.com
Thank you Jean for your answer.

The main problem is that I believe that it is a really needed feature that we have to have in the core of BBB, but from the start to now we have only very limited features related on deleting those unwanted files. I don't know why, but the developers can add the related code for deleting all kind of files related to recordings in the core of BBB in my opinion. If they want, they can comment them so they are not active by default, BUT if anyone needs to use them, they can un-comment them and edit them to match their needs. 
I saw many people asking this and it is not even a clear updated solution that we can totally manage deleting all those kind of recording files without worried.

Deleting them manually or with scripts that we find in the forums with the risk of damaging the software functionality, is not really a good solution as far as I understand. 

I really hope we see the team adding this in the future at the core of BBB.

Regarding to my problem, I deleted the script, and then rebuilt all the recordings, as there are more than 270 recordings, and hopefully, after 2-3 days all of them for 30 day back in the published and also appears in the Moodle. 

I hope the team solves this for one time in a one complete solution for all types of recording files that I mentioned in my initial message and keeps it updated for all releases and versions. 

After all, I want to thank the team for all their efforts for such good software. 

Kind Regards
Hossein

--
You received this message because you are subscribed to the Google Groups "bigbluebutton-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bigbluebutton-u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bigbluebutton-users/c4726f08-6994-4861-9098-1e36231d3d5cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages