public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Backup Script]Check for docker and docker-compose in each step seperate
6195b7c3
helper-scripts/backup_and_restore.sh | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
Diff
diff --git a/helper-scripts/backup_and_restore.sh b/helper-scripts/backup_and_restore.sh
index d6f11ca8..506420b4 100755
--- a/helper-scripts/backup_and_restore.sh
+++ b/helper-scripts/backup_and_restore.sh
@@ -76,13 +76,6 @@ else
CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd "[0-9A-Za-z-_]")
fi
-for bin in docker docker-compose; do
- if [[ -z $(which ${bin}) ]]; then
- >&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
- exit 1
- fi
-done
-
if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
>&2 echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
exit 1
@@ -94,6 +87,12 @@ function backup() {
mkdir -p "${BACKUP_LOCATION}/mailcow-${DATE}"
chmod 755 "${BACKUP_LOCATION}/mailcow-${DATE}"
cp "${SCRIPT_DIR}/../mailcow.conf" "${BACKUP_LOCATION}/mailcow-${DATE}"
+ for bin in docker; do
+ if [[ -z $(which ${bin}) ]]; then
+ >&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
+ exit 1
+ fi
+ done
while (( "$#" )); do
case "$1" in
vmail|all)
@@ -161,6 +160,12 @@ function backup() {
}
function restore() {
+ for bin in docker docker-compose; do
+ if [[ -z $(which ${bin}) ]]; then
+ >&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
+ exit 1
+ fi
+ done
echo
echo "Stopping watchdog-mailcow..."
docker stop $(docker ps -qf name=watchdog-mailcow)
@@ -354,4 +359,4 @@ elif [[ ${1} == "restore" ]]; then
done
echo "Restoring ${FILE_SELECTION[${input_sel}]} from ${RESTORE_POINT}..."
restore "${RESTORE_POINT}" ${FILE_SELECTION[${input_sel}]}
-fi
+fi
\ No newline at end of file