laradock/sync.sh

28 lines
832 B
Bash
Raw Normal View History

2017-07-15 21:40:25 +08:00
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "Missing arguments. Please specify 'up' or 'down'.";
exit 1
fi
2017-07-15 21:46:52 +08:00
if [ "$1" == "up" ] ; then
2017-07-16 00:00:35 +08:00
echo "Initializing Docker Sync (may take several minutes the first time)";
2017-07-15 21:40:25 +08:00
docker-sync start;
echo "Initializing Docker Compose";
2017-07-15 23:13:50 +08:00
shift; # removing first argument
docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@};
2017-07-15 21:46:52 +08:00
elif [ "$1" == "down" ]; then
2017-07-15 21:40:25 +08:00
echo "Stopping Docker Compose";
docker-compose down;
echo "Stopping Docker Sync";
2017-07-15 21:44:09 +08:00
docker-sync stop;
2017-07-15 23:01:52 +08:00
elif [ "$1" == "install" ]; then
echo "Installing docker-sync";
gem install docker-sync;
elif [ "$1" == "sync" ]; then
docker-sync sync;
elif [ "$1" == "clean" ]; then
docker-sync clean;
2017-07-15 21:46:52 +08:00
else
2017-07-15 23:13:50 +08:00
echo "Invalid argument. Use 'up','down','install','sync' or 'clean' ";
2017-07-15 21:40:25 +08:00
fi