Newer
Older
openhab / backup.sh
@Pascal Gollor Pascal Gollor on 3 Jan 2018 653 bytes add backup script
#!/bin/bash


# backup directory
backup_dir=backup

# load variaables form config
source openhab.conf

# current date
DATE=$(date +"%Y%m%d_%H%M%S")

# create backuop directories
mkdir -p $backup_dir/conf
mkdir -p $backup_dir/data/conf
mkdir -p $backup_dir/data/addons
mkdir -p $backup_dir/data/userdata


## backup

# main conf
tar -cjf ${PWD}/${backup_dir}/conf/${DATE}.tbz2 openhab.conf

# openHAB conf
tar -C data -cjf ${PWD}/${backup_dir}/data/conf/${DATE}.tbz2 conf

# openHAB addons
tar -C data -cjf ${PWD}/${backup_dir}/data/addons/${DATE}.tbz2 addons

# openHAB userdata
tar -C data -cjf ${PWD}/${backup_dir}/data/userdata/${DATE}.tbz2 userdata