|
@@ -109,6 +109,16 @@ runDockerCommand()
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+getContainerId()
|
|
|
|
+{
|
|
|
|
+ if [[ ${DOCKER_COMMAND} == "docker" ]]; then
|
|
|
|
+ containerId=$(${dockerCompose} ps -q "${1}")
|
|
|
|
+ else
|
|
|
|
+ containerId=$(${dockerCompose} ps | awk "/${1}/ {print \$1}")
|
|
|
|
+ fi
|
|
|
|
+ echo "${containerId}"
|
|
|
|
+}
|
|
|
|
+
|
|
case $1 in
|
|
case $1 in
|
|
start)
|
|
start)
|
|
echo -e "${CYAN}Musare | Start Services${NC}"
|
|
echo -e "${CYAN}Musare | Start Services${NC}"
|
|
@@ -194,7 +204,7 @@ case $1 in
|
|
attach)
|
|
attach)
|
|
echo -e "${CYAN}Musare | Attach${NC}"
|
|
echo -e "${CYAN}Musare | Attach${NC}"
|
|
if [[ $2 == "backend" ]]; then
|
|
if [[ $2 == "backend" ]]; then
|
|
- containerId=$(${dockerCompose} ps -q backend)
|
|
+ containerId=$(getContainerId backend)
|
|
if [[ -z $containerId ]]; then
|
|
if [[ -z $containerId ]]; then
|
|
echo -e "${RED}Error: Backend offline, please start to attach.${NC}"
|
|
echo -e "${RED}Error: Backend offline, please start to attach.${NC}"
|
|
exit 1
|
|
exit 1
|
|
@@ -204,7 +214,7 @@ case $1 in
|
|
fi
|
|
fi
|
|
elif [[ $2 == "mongo" ]]; then
|
|
elif [[ $2 == "mongo" ]]; then
|
|
MONGO_VERSION_INT=${MONGO_VERSION:0:1}
|
|
MONGO_VERSION_INT=${MONGO_VERSION:0:1}
|
|
- if [[ -z $(${dockerCompose} ps -q mongo) ]]; then
|
|
+ if [[ -z $(getContainerId mongo) ]]; then
|
|
echo -e "${RED}Error: Mongo offline, please start to attach.${NC}"
|
|
echo -e "${RED}Error: Mongo offline, please start to attach.${NC}"
|
|
exit 1
|
|
exit 1
|
|
else
|
|
else
|
|
@@ -216,7 +226,7 @@ case $1 in
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
elif [[ $2 == "redis" ]]; then
|
|
elif [[ $2 == "redis" ]]; then
|
|
- if [[ -z $(${dockerCompose} ps -q redis) ]]; then
|
|
+ if [[ -z $(getContainerId redis) ]]; then
|
|
echo -e "${RED}Error: Redis offline, please start to attach.${NC}"
|
|
echo -e "${RED}Error: Redis offline, please start to attach.${NC}"
|
|
exit 1
|
|
exit 1
|
|
else
|
|
else
|