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