mirror of
https://github.com/izzy2lost/docker-android.git
synced 2026-06-19 01:16:28 -07:00
Added auto-stop feature
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user