service-dolibarr/scripts/backup-erp
2019-05-20 19:47:26 +02:00

21 lines
427 B
Bash
Executable file

#!/bin/sh
set -x
ERP_HOST="example.com"
DATE="$(date --iso-8601)"
DISPLAY=:0
BACKUP_DIR="$HOME/Documents/Backup"
echo "Exporting database dump"
/usr/bin/setsid ssh "$ERP_HOST" \
dokku mariadb:export erp \
> "$BACKUP_DIR/$ERP_HOST.$DATE.sql"
echo "Exporting files"
/usr/bin/setsid ssh "$ERP_HOST" \
docker exec erp.web.1 \
"bash -c 'cd /var/www/html/documents ; tar czf - .'" \
> "$BACKUP_DIR/$ERP_HOST.$DATE.tar.gz"