You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.0 KiB

#!/bin/bash
action=$1
pattern=$2
declare -a serverlist
set -eu
if [ $action != "enable" -a "$action" != "disable" ]; then
echo "Error."
echo "Usage: $0 action pattern"
echo "Action has to be in [enable|disable]"
exit 1
fi
ids_servers=$(/usr/bin/docker exec scalelite-api ./bin/rake servers | grep -A2 -B1 $pattern \
| sed -e "/secret:.*/d" | tr -d "\n" | sed -e "s|abled|abled\n|g" \
| sed -e "s|/bigbluebutton/api||g" | sed "s|url: https://||g" \
| sed "s|id: ||g" | sed "s|--||g"| sed "s|\s|#|g")
# keine id keine show
if [ -z "$ids_servers" ]; then
echo "No IDs for $pattern found."
exit 0
fi
for line in $ids_servers; do
id=$(echo $line | awk -F"#" '{print $1}')
server=$(echo $line | awk -F"#" '{print $2}')
s=$(echo $line | awk -F"#" '{print $3}')
if [ "${action}d" = "$s" ] ; then
echo "$server ($id) already ${action}d."
else
echo "[$action] $server ($id)"
/usr/bin/docker exec scalelite-api ./bin/rake servers:$action[$id]
fi
done