updated command
This commit is contained in:
parent
407fb7a395
commit
abae2dc09e
28
sync.sh
28
sync.sh
@ -1,27 +1,39 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [[ $# -eq 0 ]] ; then
|
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 <services>\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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "up" ] ; then
|
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;
|
docker-sync start;
|
||||||
echo "Initializing Docker Compose";
|
printf "Initializing Docker Compose";
|
||||||
shift; # removing first argument
|
shift; # removing first argument
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@};
|
docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@};
|
||||||
|
|
||||||
elif [ "$1" == "down" ]; then
|
elif [ "$1" == "down" ]; then
|
||||||
echo "Stopping Docker Compose";
|
printf "Stopping Docker Compose";
|
||||||
docker-compose down;
|
docker-compose down;
|
||||||
echo "Stopping Docker Sync";
|
printf "Stopping Docker Sync";
|
||||||
docker-sync stop;
|
docker-sync stop;
|
||||||
|
|
||||||
elif [ "$1" == "install" ]; then
|
elif [ "$1" == "install" ]; then
|
||||||
echo "Installing docker-sync";
|
printf "Installing docker-sync";
|
||||||
gem install 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;
|
docker-sync sync;
|
||||||
|
|
||||||
elif [ "$1" == "clean" ]; then
|
elif [ "$1" == "clean" ]; then
|
||||||
|
printf "Removing and cleaning up files from the docker-sync container.";
|
||||||
docker-sync clean;
|
docker-sync clean;
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Invalid argument. Use 'up','down','install','sync' or 'clean' ";
|
printf "Invalid argument. Use 'up','down','install','trigger' or 'clean' ";
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user