Dieser Commit ist enthalten in:
MAGICCC 2021-05-05 21:29:19 +00:00
Ursprung fd522f737d
Commit 91c6674d39
3 geänderte Dateien mit 30 neuen und 80 gelöschten Zeilen

Datei anzeigen

@ -811,34 +811,6 @@
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#binsh" class="md-nav__link">
!/bin/sh
</a>
</li>
<li class="md-nav__item">
<a href="#backup-mailcow-data" class="md-nav__link">
Backup mailcow data
</a>
</li>
<li class="md-nav__item">
<a href="#httpsmailcowgithubiomailcow-dockerized-docsb_n_r_backup" class="md-nav__link">
https://mailcow.github.io/mailcow-dockerized-docs/b_n_r_backup/
</a>
</li>
<li class="md-nav__item">
<a href="#run-command" class="md-nav__link">
run command
</a>
</li>
</ul>
@ -1947,34 +1919,6 @@
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#binsh" class="md-nav__link">
!/bin/sh
</a>
</li>
<li class="md-nav__item">
<a href="#backup-mailcow-data" class="md-nav__link">
Backup mailcow data
</a>
</li>
<li class="md-nav__item">
<a href="#httpsmailcowgithubiomailcow-dockerized-docsb_n_r_backup" class="md-nav__link">
https://mailcow.github.io/mailcow-dockerized-docs/b_n_r_backup/
</a>
</li>
<li class="md-nav__item">
<a href="#run-command" class="md-nav__link">
run command
</a>
</li>
</ul>
@ -1994,6 +1938,8 @@
</a>
<h1>Backup</h1>
<h3 id="backup">Backup<a class="headerlink" href="#backup" title="Permanent link">&para;</a></h3>
<h4 id="manual">Manual<a class="headerlink" href="#manual" title="Permanent link">&para;</a></h4>
<p>You can use the provided script <code>helper-scripts/backup_and_restore.sh</code> to backup mailcow automatically.</p>
@ -2019,32 +1965,36 @@ You should not rename those folders to not break the restore process.</p>
</code></pre></div>
<h4 id="cronjob">Cronjob<a class="headerlink" href="#cronjob" title="Permanent link">&para;</a></h4>
<p>You can run the backup script regularly via cronjob. Make sure <code>BACKUP_LOCATION</code> exists:</p>
<p>```5 4 * * * cd /opt/mailcow-dockerized/; MAILCOW_BACKUP_LOCATION=/mnt/mailcow_backups /opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup mysql crypt redis --delete-days 3
<div class="highlight"><pre><span></span><code>Per default cron sends the full result of each backup operation by email. If you want cron to only mail on error (non-zero exit code) you may want to use the following snippet. Pathes need to be modified according to your setup (this script is a user contribution).
<div class="highlight"><pre><span></span><code>5 4 * * * cd /opt/mailcow-dockerized/; MAILCOW_BACKUP_LOCATION=/mnt/mailcow_backups /opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup mysql crypt redis --delete-days 3
</code></pre></div>
<p>Per default cron sends the full result of each backup operation by email. If you want cron to only mail on error (non-zero exit code) you may want to use the following snippet. Pathes need to be modified according to your setup (this script is a user contribution).</p>
<p>This following script may be placed in <code>/etc/cron.daily/mailcow-backup</code> - do not forget to mark it as executable via <code>chmod +x</code>:</p>
<div class="highlight"><pre><span></span><code>#!/bin/sh
This following script may be placed in `/etc/cron.daily/mailcow-backup` - do not forget to mark it as executable via `chmod +x`:
</code></pre></div></p>
<h1 id="binsh">!/bin/sh<a class="headerlink" href="#binsh" title="Permanent link">&para;</a></h1>
<h1 id="backup-mailcow-data">Backup mailcow data<a class="headerlink" href="#backup-mailcow-data" title="Permanent link">&para;</a></h1>
<h1 id="httpsmailcowgithubiomailcow-dockerized-docsb_n_r_backup"><a href="https://mailcow.github.io/mailcow-dockerized-docs/b_n_r_backup/">https://mailcow.github.io/mailcow-dockerized-docs/b_n_r_backup/</a><a class="headerlink" href="#httpsmailcowgithubiomailcow-dockerized-docsb_n_r_backup" title="Permanent link">&para;</a></h1>
<p>set -e</p>
<p>OUT="$(mktemp)"
export MAILCOW_BACKUP_LOCATION="/opt/backup"
SCRIPT="/opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh"
PARAMETERS="backup all"
OPTIONS="--delete-days 30"</p>
<h1 id="run-command">run command<a class="headerlink" href="#run-command" title="Permanent link">&para;</a></h1>
<p>set +e
"${SCRIPT}" ${PARAMETERS} ${OPTIONS} 2&gt;&amp;1 &gt; "$OUT"
RESULT=$?</p>
<p>if [ $RESULT -ne 0 ]
# Backup mailcow data
# https://mailcow.github.io/mailcow-dockerized-docs/b_n_r_backup/
set -e
OUT=&quot;$(mktemp)&quot;
export MAILCOW_BACKUP_LOCATION=&quot;/opt/backup&quot;
SCRIPT=&quot;/opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh&quot;
PARAMETERS=&quot;backup all&quot;
OPTIONS=&quot;--delete-days 30&quot;
# run command
set +e
&quot;${SCRIPT}&quot; ${PARAMETERS} ${OPTIONS} 2&gt;&amp;1 &gt; &quot;$OUT&quot;
RESULT=$?
if [ $RESULT -ne 0 ]
then
echo "${SCRIPT} ${PARAMETERS} ${OPTIONS} encounters an error:"
echo "RESULT=$RESULT"
echo "STDOUT / STDERR:"
cat "$OUT"
echo &quot;${SCRIPT} ${PARAMETERS} ${OPTIONS} encounters an error:&quot;
echo &quot;RESULT=$RESULT&quot;
echo &quot;STDOUT / STDERR:&quot;
cat &quot;$OUT&quot;
fi
```</p>
</code></pre></div>

Dateidiff unterdrĂĽckt, weil mindestens eine Zeile zu lang ist

Binäre Datei nicht angezeigt.