post publish script does not work

42 views
Skip to first unread message

Emre Arslan

unread,
Apr 26, 2025, 5:37:52 PMApr 26
to BigBlueButton-dev
Hi community,

As the document says: https://docs.bigbluebutton.org/2.6/development/recording/#writing-post-scripts
I have created transfer_records.rb script that copies published folders to another folder. Script works  perfect manually with:
ruby transfer_records.rb -m <meeting-id>

But it does not work automatically after recording ready script as it is alphabetically later . I tried bbb-conf --restart, systemctl stop bbb-rap-starter
systemctl stop bbb-rap-resque-worker. None of them works.

What am i missing?

Kind Regards

Christian Waidelich

unread,
Apr 27, 2025, 5:44:20 AMApr 27
to BigBlueButton-dev
Hi,

can you post your script and the output of bbb-record --watch ?

R Christian

Emre Arslan

unread,
Apr 27, 2025, 7:52:36 AMApr 27
to BigBlueButton-dev
Hi Christian,
Here is the script, bbb-record --watch result and the post_publish.log. I see post_publish_recording_ready_callback.rb runs correctly.

Script:
#!/usr/bin/ruby
# frozen_string_literal: true

require 'optparse'
require 'psych'
require 'fileutils'

puts('Published recording copy starts')

meeting_id = nil
target_base_dir = '/mnt/data/presentation'
published_dir = '/var/bigbluebutton/published/'

OptionParser.new do |opts|
  opts.on('-m', '--meeting-id MEETING_ID', 'Internal Meeting ID (required)') do |v|
    meeting_id = v
  end
end.parse!

unless meeting_id
  msg = 'Meeting ID was not provided'
  puts(msg) && raise(msg)
end

puts("Copying published recordings for meeting ID: #{meeting_id}")

format_dirs = []
FileUtils.cd(published_dir) do
  format_dirs = Dir.glob("*/#{meeting_id}")
end

if format_dirs.empty?
  puts("No published recording formats found for meeting ID: #{meeting_id}")
  exit
end

format_dirs.each do |format_dir|
  source_path = File.join(published_dir, format_dir)
  target_path = target_base_dir

  puts("Copying from: #{source_path} to: #{target_path}")

  FileUtils.mkdir_p(target_path) unless Dir.exist?(target_path)

  begin
    FileUtils.cp_r(source_path, target_path)
    puts("Successfully copied '#{File.basename(source_path)}' to '#{target_path}'.")
  rescue StandardError => e
    puts("Error copying '#{File.basename(source_path)}': #{e.message}")
  end
end

puts('Published recording copy ends')

bbb-record --watch result:
<InternalmeetingId>  Sat 26 Apr 2025 08:42:45 PM UTC  X   XXX X  XX     15 presentation         presentation       <externalId>

tail -f /var/log/bigbluebutton/post_publish.log:
Recording Ready Notify for [<InternalmeetingId>] starts
Task: Getting meeting metadata
Making callback for recording ready notification
Task: Getting external meeting id
Task: Getting meeting metadata
Recording notifier successful: <InternalmeetingId> (code 200)
Recording Ready notify ends


27 Nisan 2025 Pazar tarihinde saat 12:44:20 UTC+3 itibarıyla Christian Waidelich şunları yazdı:

Christian Waidelich

unread,
Apr 28, 2025, 3:57:09 AMApr 28
to BigBlueButton-dev
Am I seeing this right? Your script is not even called?

I am not seeing this line: Published recording copy starts in the logs.

I had a problem where I realized that the post_publish script need to be coded differently, with optimist. I think I copied from the template:

/usr/local/bigbluebutton/core/scripts/post_publish/post_publish.rb.example

#!/usr/bin/ruby
# encoding: UTF-8

#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# 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
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#

require "optimist"
require File.expand_path('../../../lib/recordandplayback', __FILE__)

opts = Optimist::options do
  opt :meeting_id, "Meeting id to archive", :type => String
  opt :format, "Playback format name", :type => String
end
meeting_id = opts[:meeting_id]

logger = Logger.new("/var/log/bigbluebutton/post_publish.log", 'weekly' )
logger.level = Logger::INFO
BigBlueButton.logger = logger

published_files = "/var/bigbluebutton/published/presentation/#{meeting_id}"
meeting_metadata = BigBlueButton::Events.get_meeting_metadata("/var/bigbluebutton/recording/raw/#{meeting_id}/events.xml")

#
# Put your code here
#



and started from there. Does it help?

Emre Arslan

unread,
Apr 28, 2025, 8:29:13 AMApr 28
to bigblueb...@googlegroups.com
Hi,

Thank you very much Christian. I have implemented the script with the existing example script as you have mentioned. optimist and fileutils packages are used. Then the scripts are executed sequentially. No need to restart any service to activate an additional rb script. Furthermore my problematic old script has the Puts() to log, it does not work. This works:

logger = Logger.new("/var/log/bigbluebutton/post_publish.log", 'weekly')
logger.level = Logger::INFO
BigBlueButton.logger = logger

You helped a lot.

Kind Regards
Emre

Christian Waidelich <cwaid...@gmail.com>, 28 Nis 2025 Pzt, 10:57 tarihinde şunu yazdı:
--
You received this message because you are subscribed to the Google Groups "BigBlueButton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bigbluebutton-...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bigbluebutton-dev/ee9174a7-de1a-4c82-bb2f-c1a9558cfab2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages