Use project name. Add is-running function.

This commit is contained in:
lablans 2023-03-08 09:00:38 +00:00
parent ea3e148fd3
commit 0ff153ef22
2 changed files with 16 additions and 3 deletions

View File

@ -66,11 +66,14 @@ case "$ACTION" in
checkRequirements checkRequirements
hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..." hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..."
export LDM_LOGIN=$(getLdmPassword) export LDM_LOGIN=$(getLdmPassword)
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit exec $COMPOSE -p bridgehead-$PROJECT -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
;; ;;
stop) stop)
loadVars loadVars
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE down exec $COMPOSE -p bridgehead-$PROJECT -f ./$PROJECT/docker-compose.yml $OVERRIDE down
;;
is-running)
exit bk_is_running
;; ;;
update) update)
loadVars loadVars

View File

@ -34,7 +34,7 @@ checkOwner(){
} }
printUsage() { printUsage() {
echo "Usage: bridgehead start|stop|update|install|uninstall|enroll PROJECTNAME" echo "Usage: bridgehead start|stop|is-running|update|install|uninstall|enroll PROJECTNAME"
echo "PROJECTNAME should be one of ccp|bbmri" echo "PROJECTNAME should be one of ccp|bbmri"
} }
@ -169,6 +169,16 @@ function retry {
return 0 return 0
} }
function bk_is_running {
RUNNING="$($COMPOSE -p bridgehead-$PROJECT -f ./$PROJECT/docker-compose.yml $OVERRIDE ps -q)"
NUMBEROFRUNNING=$(echo "$RUNNING" | wc -l)
if [ $NUMBEROFRUNNING -gt 0 ]; then
return 0
else
return 1
fi
}
##Setting Network properties ##Setting Network properties
# currently not needed # currently not needed
#export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}'); #export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}');