From abae2dc09ecfa191a8b13330d3138f95996b6d82 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 12:00:44 -0400 Subject: [PATCH] updated command --- sync.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sync.sh b/sync.sh index c88a600b..c452eb1e 100755 --- a/sync.sh +++ b/sync.sh @@ -1,27 +1,39 @@ #!/bin/bash if [[ $# -eq 0 ]] ; then - echo "Missing arguments. Please specify 'up' or 'down'."; + printf "Available commands:\n"; + printf " install\t\t Installs docker-sync gem on the host machine.\n"; + printf " up \t Starts docker-sync and runs docker compose.\n"; + printf " down \t\t Stops containers and docker-sync.\n"; + printf " trigger \t\t Manually triggers the synchronization of files.\n"; + printf " clean \t\t Removes all synched files from docker-sync container.\n"; exit 1 fi if [ "$1" == "up" ] ; then - echo "Initializing Docker Sync (may take several minutes the first time)"; + printf "Initializing Docker Sync (may take several minutes the first time)"; docker-sync start; - echo "Initializing Docker Compose"; + printf "Initializing Docker Compose"; shift; # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; + elif [ "$1" == "down" ]; then - echo "Stopping Docker Compose"; + printf "Stopping Docker Compose"; docker-compose down; - echo "Stopping Docker Sync"; + printf "Stopping Docker Sync"; docker-sync stop; + elif [ "$1" == "install" ]; then - echo "Installing docker-sync"; + printf "Installing docker-sync"; gem install docker-sync; -elif [ "$1" == "sync" ]; then + +elif [ "$1" == "trigger" ]; then + printf "Manually triggering sync between host and docker-sync container."; docker-sync sync; + elif [ "$1" == "clean" ]; then + printf "Removing and cleaning up files from the docker-sync container."; docker-sync clean; + else - echo "Invalid argument. Use 'up','down','install','sync' or 'clean' "; + printf "Invalid argument. Use 'up','down','install','trigger' or 'clean' "; fi