Sicherung von Daten ist ja immer gut. Wenn dann mal die SD-Karte crasht, kann man sein openHAB 2 wieder herstellen. In openHAB 2 ist eine Backup und Restore Funktion integriert.
Man braucht nur das Backupscript aufrufen:
1 |
sudo $OPENHAB_RUNTIME/bin/backup |
und das Passwort eingeben:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
openhabian@pi-org:/usr/share/openhab2$ sudo $OPENHAB_RUNTIME/bin/backup [sudo] password for openhabian: ######################################### openHAB 2.x.x backup script ######################################### Using '/etc/openhab2' as conf folder... Using '/var/lib/openhab2' as userdata folder... Using '/usr/share/openhab2/runtime' as runtime folder... Using '/var/lib/openhab2/backups' as backup folder... Writing to '/var/lib/openhab2/backups/openhab2-backup-19_01_14-17_27_42.zip'... Making Temporary Directory if it is not already there Using /tmp/openhab2/backup as TempDir Copying configuration to temporary folder... Removing unnecessary files... Backup Directory is inside userdata, not including in this backup! Zipping folder... Removing temporary files... Success! Backup made in /var/lib/openhab2/backups/openhab2-backup-19_01_14-17_27_42.zip |
Schon hat man ein Backuparchive in
/var/lib/openhab2/backups/openhab2-backup-19_01_14-17_27_42.zip
Einfacher geht es nicht.
Dieses ZIP-Archiv auf einen anderen Datenträger sichern, das ist schon alles. Hier noch weitere Optionen:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
openhabian@pi-org:/usr/share/openhab2$ $OPENHAB_RUNTIME/bin/backup --help ######################################### openHAB 2.x.x backup script ######################################### Usage: backup [--full] [filename] e.g. ./backup << Makes a file with a timed filename ./backup myBackup.zip << Makes a file called myBackup.zip ./backup --full << Makes a full backup file with a timed filename ./backup --full myBackup.zip << Makes a full backup file called myBackup.zip Use this script to backup your openHAB configuration, you can use the 'restore' script from any machine to transfer your configuration across to another instance. A full backup includes the tmp and cache directories that are normally excluded. Set /var/lib/openhab2/backups to change the default backup directory. Set to change the default backup temporary directory. |
Um die Daten aus einen gesicherten Backup wieder herzustellen reicht ein
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# wenn openhab2 läuft stoppen sudo systemctl stop openhab2 sudo $OPENHAB_RUNTIME/bin/restore $OPENHAB_BACKUPS/openhab2-backup-19_01_14-17_27_42.zip # Ausgabe ########################################## # openHAB 2.x.x restore script ########################################## # Using '/etc/openhab2' as conf folder... # Using '/var/lib/openhab2' as userdata folder... # Making Temporary Directory # Extracting zip file to temporary folder. # Backup Information: ------------------- # Backup Version | 2.4.0 (You are on 2.4.0) # Backup Timestamp | 19_01_14-16_06_23 # Config belongs to user | openhab # from group | openhabian # Your current configuration will become owned by openhab:openhabian. # Any existing files with the same name will be replaced. # Any file without a replacement will be deleted. # Frage mit y Beantworten #Okay to Continue? [y/N]: y # Moving system files in userdata to temporary folder # Deleting old userdata folder... # Restoring system files in userdata... # Deleting old conf folder... # Restoring openHAB with backup configuration... # Deleting temporary files... # Backup successfully restored! # openhab2 wieder starten sudo systemctl start openhab2 |