Skip to content

Instantly share code, notes, and snippets.

@MagnusTiberius
Created November 30, 2017 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MagnusTiberius/8f78b85c925293300e439512a1592aa7 to your computer and use it in GitHub Desktop.
Save MagnusTiberius/8f78b85c925293300e439512a1592aa7 to your computer and use it in GitHub Desktop.
#!/bin/sh
#setup.sh
#Detect docker service, then exit if dockerd is not running.
servicedocker="[/]dockerd"
if ps aux | grep "$servicedocker"; then
echo "Docker is running"
else
echo "Docker is not running"
echo "Please install Docker: sudo apt install docker.io\n\n"
echo "https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04"
exit
fi
#Setup dynamodb
file=./dynamodb_local_latest.tar.gz
if [ -e "$file" ]; then
echo "File $file exists"
else
echo "\n\nFile $file does not exist, downloading from repo storage.\n\n"
wget https://s3.ap-south-1.amazonaws.com/dynamodb-local-mumbai/dynamodb_local_latest.tar.gz
fi
service="[.]/DynamoDBLocal"
if ps aux | grep "$service"; then
echo "running"
else
echo "not running"
dr=./dynamodb
if [ -e "$dr" ]; then
echo "Directory $dr exists"
cd dynamodb
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -port 8000 &
cd ..
else
echo "Directory does not exist"
mkdir dynamodb
tar -zxvf $file -C ./dynamodb
cd dynamodb
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -port 8000 &
cd ..
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment