docker-android/genymotion/geny_start.sh
2018-05-30 00:54:06 +02:00

28 lines
725 B
Bash
Executable file

#!/bin/bash
# This script is needed because of https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/
if [ -z "$GENY_TEMPLATE" ]; then
GENY_TEMPLATE="/root/tmp/devices.json"
fi
if [ ! -f "$GENY_TEMPLATE" ]; then
echo "File not found! Nothing to do!"
exit 1
fi
contents=$(cat $GENY_TEMPLATE)
getAbort() {
echo "ABORT SIGNAL detected! Stopping all created emulators..."
for row in $(echo "${contents}" | jq -r '.[] | @base64'); do
get_value() {
echo ${row} | base64 --decode | jq -r ${1}
}
gmtool --cloud admin stopdisposable $(get_value '.device')
done
echo "Done"
}
trap 'getAbort; exit' EXIT
/usr/bin/supervisord --configuration supervisord.conf