Skip to content
Snippets Groups Projects
Commit 23c90f1a authored by Richard Alam's avatar Richard Alam
Browse files

- put publishing to matterhorn on a different process since it needs to run as root

parent 6e3546ae
No related branches found
No related tags found
No related merge requests found
# NOTE:
# Copy into /etc/bigbluebutton/god/conf
# sudo cp matt-pub-god-conf.rb /etc/bigbluebutton/god/conf/matterhorn-publish-conf.rb
#
# Monitors the BigBlueButton Matterhorn publisher process
God.watch do |w|
# The name of the watcher
w.name = "bbb-matterhorn-publisher"
# The default time for reporting the state of the monitored process
w.interval = 1.minute
# Start the process
w.start = "ruby publisher-matterhorn.rb"
# Start your process in this directory
w.dir = "/usr/local/bigbluebutton/core/scripts/"
# Time to wait before monitoring, after starting the process
w.start_grace = 30.seconds
# Cleans the pid file before starting the process.
# god will daemonizes the process
w.behavior(:clean_pid_file)
# Start the process if it is not running
# And report its status every 30 seconds
# In other words god revives the process every time it dies
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 30.seconds
c.running = false
end
end
end
require '../../core/lib/recordandplayback'
require 'rubygems'
require 'yaml'
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
matt_props = YAML::load(File.open('matterhorn.yml'))
scp_server = matt_props['scp_server']
scp_inbox = matt_props['scp_inbox']
scp_key = matt_props['scp_key']
scp_user = matt_props['scp_user']
recording_dir = bbb_props['recording_dir']
done_files = Dir.glob("#{recording_dir}/status/processed/*.done")
done_files.each do |df|
match = /(.*)-(.*).done/.match df.sub(/.+\//, "")
meeting_id = match[1]
if (match[2] == "matterhorn")
BigBlueButton.logger = Logger.new("/var/log/bigbluebutton/matterhorn-publish-#{meeting_id}.log", 'daily' )
process_dir = "#{recording_dir}/process/matterhorn/#{meeting_id}"
target_dir = "#{recording_dir}/publish/matterhorn/#{meeting_id}"
if not FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir
WEBCAM = "muxed-audio-webcam.flv"
DESKSHARE = "deskshare.flv"
MANIFEST = "manifest.xml"
DUBLIN = "dublincore.xml"
[WEBCAM, DESKSHARE, MANIFEST, DUBLIN].each { |file| FileUtils.cp("#{process_dir}/#{file}", target_dir)}
Dir.chdir(target_dir) do
BigBlueButton::MatterhornProcessor.zip_artifacts(WEBCAM, DESKSHARE, DUBLIN, MANIFEST, "#{meeting_id}.zip")
end
command = "scp -i #{scp_key} #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}"
BigBlueButton.logger.info(command)
Open3.popen3(command) do | stdin, stdout, stderr|
BigBlueButton.logger.info("scp result=#{$?.exitstatus}")
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment