add func doDocker
This commit is contained in:
parent
4fb6315643
commit
9d7b7e1a94
18
.vscode/numbered-bookmarks.json
vendored
18
.vscode/numbered-bookmarks.json
vendored
@ -1,3 +1,19 @@
|
||||
{
|
||||
"bookmarks": []
|
||||
"bookmarks": [
|
||||
{
|
||||
"fsPath": "$ROOTPATH$/backup/backup.sh",
|
||||
"bookmarks": [
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
580
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -97,6 +97,26 @@ cleanup() {
|
||||
fi
|
||||
}
|
||||
|
||||
doDocker() {
|
||||
containerName="$( docker ps -a --format '{{ .Names }}' --filter name=${COMPOSE_PROJECT_NAME}_${2}-mailcow_1 )"
|
||||
|
||||
# determine action to take
|
||||
if [ "$1" = "stop" ]; then
|
||||
printf "%s[%s] -- [INFO] Stopping %s-mailcow container --%s\n" \
|
||||
"$cyan" "$(stamp)" "$2" "$norm" >> "$logFile"
|
||||
docker-compose -f "$mcDockerCompose" stop --timeout "$dockerStopTimeout" "$2-mailcow" 2>> "$logFile"
|
||||
# set result vars
|
||||
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
|
||||
dockerResultExit="$( docker inspect -f '{{ .State.ExitCode }}' $containerName )"
|
||||
elif [ "$1" = "start" ]; then
|
||||
printf "%s[%s] -- [INFO] Starting %s-mailcow container --%s\n" \
|
||||
"$cyan" "$(stamp)" "$2" "$norm" >> "$logFile"
|
||||
docker-compose -f "$mcDockerCompose" start "$2-mailcow" 2>> "$logFile"
|
||||
# set result vars
|
||||
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
|
||||
fi
|
||||
}
|
||||
|
||||
# call cleanup and then exit with error report
|
||||
exitError() {
|
||||
printf "%s[%s] -- [ERROR] %s: %s --%s\n" \
|
||||
|
Loading…
Reference in New Issue
Block a user