Move utility bash scripts

This commit is contained in:
2014-12-27 12:36:48 +01:00
parent f0143ff60a
commit 883a189597
5 changed files with 41 additions and 55 deletions

22
bin/app
View File

@@ -1,4 +1,18 @@
DIR=`pwd`
cd /opt/docker/images/$1/
bin/app "$2"
cd $DIR
DIR=`dirname $0`
DIR=`readlink -e $DIR`
BASE=`basename $DIR`
IFS='/' read -ra ADDR <<< "$DIR"
CONTAINER=${ADDR[-2]}
while : ; do
ID=`docker ps --no-trunc | grep $CONTAINER: | cut -d' ' -f1`
if [ -n "$ID" ]; then
break
fi
if [ ! -n "$STARTED" ]; then
echo "Starting container."
/opt/docker/bin/run $CONTAINER &
STARTED=yes
sleep 10
fi
done
/opt/docker/bin/ssh $CONTAINER $1 "source .profile; /opt/$CONTAINER"