Merge pull request #9042 from basisbit/patch-2

add missing bbb-restart-kms script which was added to 2.2.3 but is missing in the repo
This commit is contained in:
Anton Georgiev 2020-05-28 16:24:27 -04:00 committed by GitHub
commit 9b5263e8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,35 @@
#!/bin/bash
#
# Restart Kurento every 24+ hours
#
if [ ! -f /var/tmp/bbb-kms-last-restart.txt ]; then
date +%Y-%m-%d\ %H:%M:%S > /var/tmp/bbb-kms-last-restart.txt
exit
fi
users=$(mongo --quiet mongodb://127.0.1.1:27017/meteor --eval "db.users.count({connectionStatus: 'online'})")
if [ "$users" -eq 0 ]; then
# Make sure 24 hours have passed since last restart
# Seconds since epoch for last restart
dt1=$(cat /var/tmp/bbb-kms-last-restart.txt)
t1=`date --date="$dt1" +%s`
# Current seconds since epoch
dt2=`date +%Y-%m-%d\ %H:%M:%S`
t2=`date --date="$dt2" +%s`
# Hours since last restart
let "tDiff=$t2-$t1"
let "hDiff=$tDiff/3600"
if [ "$hDiff" -ge 24 ]; then
systemctl restart kurento-media-server bbb-webrtc-sfu
date +%Y-%m-%d\ %H:%M:%S > /var/tmp/bbb-kms-last-restart.txt
fi
fi