Compare commits
No commits in common. "3c5d766d0c4385602d0f9819d25a2f56cad045ee" and "062ef420ec51c52c30429028883891d223c71434" have entirely different histories.
3c5d766d0c
...
062ef420ec
@ -197,7 +197,7 @@ function cleanup {
|
|||||||
## restart mailflow docker containers
|
## restart mailflow docker containers
|
||||||
# start and verify postfix
|
# start and verify postfix
|
||||||
operateDocker start postfix
|
operateDocker start postfix
|
||||||
if [ "$dockerResultState" = "true" ]; then
|
if [ "$dockerResult" = "true" ]; then
|
||||||
echo -e "${info}${stamp} -- [INFO] Postfix container is running --" \
|
echo -e "${info}${stamp} -- [INFO] Postfix container is running --" \
|
||||||
"${normal}" >> "$logFile"
|
"${normal}" >> "$logFile"
|
||||||
else
|
else
|
||||||
@ -205,7 +205,7 @@ function cleanup {
|
|||||||
fi
|
fi
|
||||||
# start and verify dovecot
|
# start and verify dovecot
|
||||||
operateDocker start dovecot
|
operateDocker start dovecot
|
||||||
if [ "$dockerResultState" = "true" ]; then
|
if [ "$dockerResult" = "true" ]; then
|
||||||
echo -e "${info}${stamp} -- [INFO] Dovecot container is running --" \
|
echo -e "${info}${stamp} -- [INFO] Dovecot container is running --" \
|
||||||
"${normal}" >> "$logFile"
|
"${normal}" >> "$logFile"
|
||||||
else
|
else
|
||||||
@ -221,19 +221,14 @@ if [ "$1" = "stop" ]; then
|
|||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
|
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
|
||||||
2>> "$logFile"
|
2>> "$logFile"
|
||||||
# verify container stopped (should return true)
|
# verify
|
||||||
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
|
dockerResult=$(docker inspect -f '{{ .State.ExitCode }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
|
||||||
# verify clean stop (exit code 0)
|
|
||||||
dockerResultExit=$(docker inspect -f '{{ .State.ExitCode }}' \
|
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
|
||||||
elif [ "$1" = "start" ]; then
|
elif [ "$1" = "start" ]; then
|
||||||
echo -e "${op}${stamp} Starting ${2}-mailcow container...${normal}" \
|
echo -e "${op}${stamp} Starting ${2}-mailcow container...${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
docker-compose start ${2}-mailcow 2>> "$logFile"
|
docker-compose start ${2}-mailcow 2>> "$logFile"
|
||||||
# verify
|
# verify
|
||||||
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
|
dockerResult=$(docker inspect -f '{{ .State.Running }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,9 +438,6 @@ echo -e "${info}${stamp} -- [INFO] using ${lit}${dockerComposeFilePath}" \
|
|||||||
### Import additional variables from mailcow configuration file
|
### Import additional variables from mailcow configuration file
|
||||||
source "${mailcowConfigFilePath}"
|
source "${mailcowConfigFilePath}"
|
||||||
|
|
||||||
### Export PATH so this script can access all docker and docker-compose commands
|
|
||||||
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
|
|
||||||
### Export logFile variable for use by Borg
|
### Export logFile variable for use by Borg
|
||||||
export logFile="$logFile"
|
export logFile="$logFile"
|
||||||
|
|
||||||
@ -532,7 +524,7 @@ cd "$mailcowPath"
|
|||||||
## Stop postfix-mailcow container
|
## Stop postfix-mailcow container
|
||||||
operateDocker stop postfix
|
operateDocker stop postfix
|
||||||
# process result
|
# process result
|
||||||
if [ "$dockerResultState" = "false" ] && [ "$dockerResultExit" -eq 0 ]; then
|
if [ "$dockerResult" -eq 0 ]; then
|
||||||
echo -e "${info}${stamp} -- [INFO] Postfix container stopped --${normal}" \
|
echo -e "${info}${stamp} -- [INFO] Postfix container stopped --${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
else
|
else
|
||||||
@ -543,7 +535,7 @@ fi
|
|||||||
## Stop dovecot-mailcow container
|
## Stop dovecot-mailcow container
|
||||||
operateDocker stop dovecot
|
operateDocker stop dovecot
|
||||||
# process result
|
# process result
|
||||||
if [ "$dockerResultState" = "false" ] && [ "$dockerResultExit" -eq 0 ]; then
|
if [ "$dockerResult" -eq 0 ]; then
|
||||||
echo -e "${info}${stamp} -- [INFO] Dovecot container stopped --${normal}" \
|
echo -e "${info}${stamp} -- [INFO] Dovecot container stopped --${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
else
|
else
|
||||||
@ -556,7 +548,7 @@ fi
|
|||||||
### Dump SQL
|
### Dump SQL
|
||||||
echo -e "${op}${stamp} Dumping mailcow SQL database...${normal}" >> "$logFile"
|
echo -e "${op}${stamp} Dumping mailcow SQL database...${normal}" >> "$logFile"
|
||||||
docker-compose exec mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > "$sqlDumpDir/$sqlDumpFile" 2>> "$logFile"
|
docker-compose exec mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > "$sqlDumpDir/$sqlDumpFile" 2>> "$logFile"
|
||||||
checkResult=$(docker-compose exec -T mysql-mailcow echo $?)
|
checkResult=$(docker-compose exec mysql-mailcow echo "$?")
|
||||||
# verify sql dump was successful
|
# verify sql dump was successful
|
||||||
if [ "$checkResult"=0 ]; then
|
if [ "$checkResult"=0 ]; then
|
||||||
echo -e "${ok}${stamp} -- [SUCCESS] SQL successfully dumped --${normal}" \
|
echo -e "${ok}${stamp} -- [SUCCESS] SQL successfully dumped --${normal}" \
|
||||||
@ -569,7 +561,7 @@ fi
|
|||||||
### Save redis state
|
### Save redis state
|
||||||
echo -e "${op}${stamp} Saving redis state information...${normal}" >> "$logFile"
|
echo -e "${op}${stamp} Saving redis state information...${normal}" >> "$logFile"
|
||||||
docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1
|
docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1
|
||||||
checkResult=$(docker-compose exec -T redis-mailcow echo "$?")
|
checkResult=$(docker-compose exec redis-mailcow echo "$?")
|
||||||
# Verify save was successful
|
# Verify save was successful
|
||||||
if [ "$checkResult"=0 ]; then
|
if [ "$checkResult"=0 ]; then
|
||||||
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
|
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
|
||||||
|
Loading…
Reference in New Issue
Block a user