Last active
January 26, 2018 08:21
-
-
Save daimor/1f10d4aa89c9420b62b9662d004a2f45 to your computer and use it in GitHub Desktop.
csession script which working with docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NAME=$1 | |
CONTAINER=`docker container ls -q -f "name=$NAME"` | |
if [ -z $CONTAINER ] | |
then | |
echo "Docker container with name $NAME not found" | |
exit 1 | |
fi | |
INSTANCE=`docker container inspect $CONTAINER -f '{{range .Config.Env }}{{println .}}{{end}}' | grep 'ISC_PACKAGE_INSTANCENAME' | cut -d'=' -f2` | |
echo "Container $CONTAINER" | |
echo "Instance $INSTANCE" | |
if [ -z $INSTANCE ] | |
then | |
echo "Cache instance in container with name $NAME not found" | |
exit 1 | |
fi | |
docker exec -it $CONTAINER csession $INSTANCE ${@:2} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment