---
title: "Backup per Cronjob"
url: "https://www.typo3.net/d/87297-backup-per-cronjob"
source: "typo3.net"
tags: ["Hosting","Server","Frage"]
created: "2009-02-25"
last_reply: "2009-02-28"
replies: 5
solved: false
page: 1
pages: 1
lang: "de"
---

# Backup per Cronjob

Hosting › Server · 5 Antworten · gestartet 2009-02-25

## Eröffnungsbeitrag

**gallolu** · 2009-02-25 · [Beitrag #1](https://www.typo3.net/d/87297-backup-per-cronjob/1)

Hallo, hab da mal ne Frage zu meinem Backupskript, was ich mir vor ner Zeit angelegt hatte.

```bash
#!/bin/bash

# Backup-Verzeichnis
BACKUP_DIR="/var/www/html/******/files/backup"

# MySQL-Zugangsdaten
DB_HOST=localhost
DB_USER=******
DB_PASS=******

### Einstellungen TYPO3 ###
DOC_ROOT1="/var/www/html/******/html/typo3"
DB_NAME1=******

# Datenbank
mysqldump --opt --host=$DB_HOST --user=$DB_USER --password=$DB_PASS $DB_NAME1 | gzip -c > $BACKUP_DIR/database-typo3.sql.gz

# Dateisystem
nice -n 15 tar -cpzf $BACKUP_DIR/filesystem-typo3.tar.gz $DOC_ROOT1
```

Wird im Confixx über den Befehl "sh /var/www/html/***/files/backup.sh" aufgerufen.

Das Backup funktioniert ohne Probleme, meine Frage wäre nun, wie ich
a) die eMail-Benachrichtigung ausschalte (Nachricht: "tar: Removing leading `/' from member names")
b) die Dateien nach Datum (automatisch) nummerieren kann.

## Antworten

### [#2](https://www.typo3.net/d/87297-backup-per-cronjob/2) · webdeveloper · 2009-02-25

Hallo,

a) nach dem Scriptaufruf in Confixx ein " > /dev/null" (also sowas wie "sh /var/www/html/***/files/backup.sh > /dev/null")
b) `date +%Y%m%d`

### [#3](https://www.typo3.net/d/87297-backup-per-cronjob/3) · gallolu · 2009-02-26

```html
#!/bin/bash

# Backup-Verzeichnis
BACKUP_DIR="/var/www/html/******/files/backup"

# MySQL-Zugangsdaten
DB_HOST=localhost
DB_USER=******
DB_PASS=******

### Einstellungen TYPO3 ###
DOC_ROOT1="/var/www/html/******/html/typo3"
DB_NAME1=******

# Datenbank
mysqldump --opt --host=$DB_HOST --user=$DB_USER --password=$DB_PASS $DB_NAME1 | gzip -c > $BACKUP_DIR/%Y%m%d-database-typo3.sql.gz

# Dateisystem
nice -n 15 tar -cpzf $BACKUP_DIR/%Y%m%d-filesystem-typo3.tar.gz $DOC_ROOT1
```

So?

### [#4](https://www.typo3.net/d/87297-backup-per-cronjob/4) · webdeveloper · 2009-02-26

Nein, so wie ich es geschrieben habe ;)

`date +%Y%m%d`   und nicht nur %Y%m%d. %Y%m%d ist nichts.

### [#5](https://www.typo3.net/d/87297-backup-per-cronjob/5) · gallolu · 2009-02-26

```typoscript
#!/bin/bash

# Backup-Verzeichnis
BACKUP_DIR="/var/www/html/******/files/backup"

# MySQL-Zugangsdaten
DB_HOST=localhost
DB_USER=******
DB_PASS=******

### Einstellungen TYPO3 ###
DOC_ROOT1="/var/www/html/******/html/typo3"
DB_NAME1=******

# Datenbank
mysqldump --opt --host=$DB_HOST --user=$DB_USER --password=$DB_PASS $DB_NAME1 | gzip -c > $BACKUP_DIR/'date +%Y%m%d'-database-typo3.sql.gz

# Dateisystem
nice -n 15 tar -cpzf $BACKUP_DIR/'date +%Y%m%d'-filesystem-typo3.tar.gz $DOC_ROOT1
```

Also genau so? :)

### [#6](https://www.typo3.net/d/87297-backup-per-cronjob/6) · webdeveloper · 2009-02-28

Schaut korrekt aus. Wenn du die Mails nun nicht mehr bekommen willst, beim Aufruf des Cron einfach besagtes " > /dev/null" dahinter.

---

Quelle: „Backup per Cronjob“, typo3.net, https://www.typo3.net/d/87297-backup-per-cronjob
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
