refactor(RESTORE): add logging for mailcow start/stop
This commit is contained in:
parent
06df565348
commit
f28ad5e6e7
@ -368,14 +368,18 @@ if [ "$restoreSQL" -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### stop containers (necessary for all restore operations except SQL)
|
### stop containers (necessary for all restore operations except SQL)
|
||||||
|
writeLog 'task' "Stopping mailcow"
|
||||||
if ! docker-compose down --timeout "${dockerStopTimeout}" > /dev/null 2>&1; then
|
if ! docker-compose down --timeout "${dockerStopTimeout}" > /dev/null 2>&1; then
|
||||||
|
writeLog 'done' 'error'
|
||||||
writeLog 'error' '20' "Unable to bring mailcow containers down -- cannot reliably restore. Aborting."
|
writeLog 'error' '20' "Unable to bring mailcow containers down -- cannot reliably restore. Aborting."
|
||||||
exitError 20
|
exitError 20
|
||||||
fi
|
fi
|
||||||
if [ "$( docker ps --filter "name=${COMPOSE_PROJECT_NAME}" -q | wc -l )" -gt 0 ]; then
|
if [ "$( docker ps --filter "name=${COMPOSE_PROJECT_NAME}" -q | wc -l )" -gt 0 ]; then
|
||||||
|
writeLog 'done' 'error'
|
||||||
writeLog 'error' '20' "Unable to bring mailcow containers down -- cannot reliably restore. Aborting."
|
writeLog 'error' '20' "Unable to bring mailcow containers down -- cannot reliably restore. Aborting."
|
||||||
exitError 20
|
exitError 20
|
||||||
fi
|
fi
|
||||||
|
writeLog 'done'
|
||||||
|
|
||||||
### restore mail and encryption key
|
### restore mail and encryption key
|
||||||
if [ "$restoreMail" -eq 1 ]; then
|
if [ "$restoreMail" -eq 1 ]; then
|
||||||
@ -554,10 +558,13 @@ if [ "$restoreRedis" -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### restart mailcow
|
### restart mailcow
|
||||||
|
writeLog 'task' "Starting mailcow"
|
||||||
if ! docker-compose up -d > /dev/null 2>&1; then
|
if ! docker-compose up -d > /dev/null 2>&1; then
|
||||||
|
writeLog 'done' 'warn'
|
||||||
writeLog 'warn' '21' "Unable to automatically start mailcow containers. Please attempt a manual start and note any errors."
|
writeLog 'warn' '21' "Unable to automatically start mailcow containers. Please attempt a manual start and note any errors."
|
||||||
warnCount=$((warnCount+1))
|
warnCount=$((warnCount+1))
|
||||||
fi
|
fi
|
||||||
|
writeLog 'done'
|
||||||
|
|
||||||
### exit gracefully
|
### exit gracefully
|
||||||
if [ "$errorCount" -gt 0 ]; then
|
if [ "$errorCount" -gt 0 ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user