Projekt

Allgemein

Profil

MailCow » Historie » Version 1

Jeremias Keihsler, 01.09.2021 15:59

1 1 Jeremias Keihsler
h1. MailCow
2
3
h2. Backup
4
5
taken from https://mailcow.github.io/mailcow-dockerized-docs/b_n_r_backup/
6
7
create backup-target-location
8
9
<pre><code class="shell">
10
mkdir /mnt/mailcow_backups
11
</code></pre>
12
13
create daily-backup-script @/etc/cron.daily/mailcow_backup.sh@
14
<pre><code class="shell">
15
#!/bin/sh
16
17
# Backup mailcow data
18
# https://mailcow.github.io/mailcow-dockerized-docs/b_n_r_backup/
19
20
set -e
21
22
OUT="$(mktemp)"
23
export MAILCOW_BACKUP_LOCATION="/mnt/mailcow_backups"
24
SCRIPT="/opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh"
25
PARAMETERS="backup all"
26
OPTIONS="--delete-days 30"
27
28
# run command
29
set +e
30
"${SCRIPT}" ${PARAMETERS} ${OPTIONS} 2>&1 > "$OUT"
31
RESULT=$?
32
33
if [ $RESULT -ne 0 ]
34
    then
35
            echo "${SCRIPT} ${PARAMETERS} ${OPTIONS} encounters an error:"
36
            echo "RESULT=$RESULT"
37
            echo "STDOUT / STDERR:"
38
            cat "$OUT"
39
fi
40
</code></pre>